updates! #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Updates Id and name of profiles | |
# | |
# Triggered by: | |
# PR to main | |
name: Update id | |
on: | |
pull_request: | |
branches: ['main'] | |
paths: ['data/**'] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Get list of changed files | |
id: changed_files | |
run: | | |
git fetch origin main | |
git diff --name-only origin/main...HEAD > changed_files.txt | |
cat changed_files.txt | |
- name: Run update script | |
id: update | |
run: | | |
changed_files=$(cat changed_files.txt | grep '^data/.*\.json$' | tr '\n' ' ') | |
if [ -n "$changed_files" ]; then | |
python scripts/update.py $changed_files | |
fi | |
- name: Commit and push changes | |
if: steps.update.outputs.changed == 'true' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add profiles/ | |
git commit -m 'Update profiles' | |
git push |