From ffdbfc8c2bee9d0693219f44c067cfb860bb41dc Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Tue, 16 Jan 2024 16:08:24 -0900 Subject: [PATCH] CI: don't push reformats on forks --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a177a4..0ca94e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,11 +60,10 @@ jobs: - name: Test that SQL data is up to date - normalized run: python sql/generate_sql.py - name: Commit and push changes - # Don't do this on tags - if: ${{ !startsWith(github.event.ref, 'refs/tags') }} + # Don't do this on tags or forks + if: ${{ !startsWith(github.event.ref, 'refs/tags') && github.repository == 'carltonnorthern/nicknames'}} run: | git config user.name "$(git log -n 1 --pretty=format:%an)" git config user.email "$(git log -n 1 --pretty=format:%ae)" # short-circuit if we have no changes, otherwise attempt to commit and push - # should only fail on forks, in which case contributors will need to manually format, commit, and push git diff --quiet || (echo "Committing changes" && git commit -am '${{ env.CI_COMMIT_MESSAGE }}' && echo "Pushing changes" && git push -f)