From 0e49cac530c3dacedee5a0a385dd75871824f898 Mon Sep 17 00:00:00 2001 From: Ruoyu Zhong Date: Mon, 15 Jul 2024 14:42:07 -0400 Subject: [PATCH] workflows/sync-shared-config: only force push if there are changes No need to update the branch if there are no changes. --- .github/workflows/sync-shared-config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-shared-config.yml b/.github/workflows/sync-shared-config.yml index 95235937..d830812e 100644 --- a/.github/workflows/sync-shared-config.yml +++ b/.github/workflows/sync-shared-config.yml @@ -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 \ @@ -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 }}