diff --git a/.github/workflows/calendar.yml b/.github/workflows/calendar.yml index 046d8e9..6854fe9 100644 --- a/.github/workflows/calendar.yml +++ b/.github/workflows/calendar.yml @@ -4,6 +4,7 @@ on: schedule: - cron: '0 0 * * *' workflow_dispatch: + pull_request: jobs: update-tournaments: @@ -30,8 +31,29 @@ jobs: run: | python _scripts/update_tournaments.py + - name: Add tournaments diff to summary (pull requests only) + if: github.event_name == 'pull_request' + run: | + diff_output=$(git diff -- _data/tournaments.tsv) + if [ -z "$diff_output" ]; then + { + echo "## Tournament list diff" + echo + echo "No changes in \\`_data/tournaments.tsv\\`." + } >> "$GITHUB_STEP_SUMMARY" + else + { + echo "## Tournament list diff" + echo + echo '```diff' + echo "$diff_output" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + fi + # Commit all changed files back to the repository - uses: stefanzweifel/git-auto-commit-action@v7 + if: github.event_name != 'pull_request' with: commit_message: Update tournaments file_pattern: '*.tsv'