Skip to content

Commit

Permalink
workflows/sync-shared-config: only force push if there are changes
Browse files Browse the repository at this point in the history
No need to update the branch if there are no changes.
  • Loading branch information
ZhongRuoyu committed Jul 15, 2024
1 parent 564eb38 commit 0e49cac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/sync-shared-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ jobs:
cd target/${{ matrix.repo }}
git checkout -b sync-shared-config
git push --set-upstream --force origin sync-shared-config
if gh api \
-X GET \
Expand All @@ -120,7 +119,14 @@ jobs:
-f state=open |
jq --exit-status 'length == 0'
then
git push --set-upstream --force origin sync-shared-config
gh pr create --head sync-shared-config --title "Synchronize shared configuration" --body 'This pull request was created automatically by the [`sync-shared-config`](https://github.com/Homebrew/.github/blob/HEAD/.github/actions/sync/shared-config.rb) workflow.'
else
git fetch origin sync-shared-config
if ! git diff --no-ext-diff --quiet --exit-code origin/sync-shared-config
then
git push --force origin sync-shared-config
fi
fi
env:
GH_REPO: ${{ matrix.repo }}
Expand Down

0 comments on commit 0e49cac

Please sign in to comment.