Skip to content

Commit

Permalink
fix: gh-action: dont commit+push with no new data
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarreira committed Nov 12, 2021
1 parent 96eaa2f commit 926a488
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/update_static_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Actualização da static-data
on:
schedule:
# Every day at 1:00 (AM) UTC
- cron: '0 1 * * *'
- cron: "0 1 * * *"

jobs:
run-validation-scripts:
Expand All @@ -13,17 +13,21 @@ jobs:
uses: actions/checkout@v2

- name: Run update script(s)
id: updatestaticdata
run: |
python "${GITHUB_WORKSPACE}/scripts/update_static_data.py"
echo "::set-output name=updated_files::$(git status --porcelain=v1 2>/dev/null | wc -l)"
- name: Commit file(s)
if: steps.updatestaticdata.outputs.updated_files != 0
run: |
git config --local user.email "<>"
git config --local user.name "GitHub Actions"
git add static-data/
git commit -m "Update de $(date +"%Y-%m-%d")"
- name: Push changes # push the output folder to your repo
if: steps.updatestaticdata.outputs.updated_files != 0
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 926a488

Please sign in to comment.