From 49f5fb14f0d6073da37838aef1d61c18e15381be Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Sun, 1 Sep 2024 20:40:37 +1000 Subject: [PATCH] google-fonts: fix commands --- .github/workflows/google-fonts.yml | 40 ++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/google-fonts.yml b/.github/workflows/google-fonts.yml index a9755faf47749..a455fb5ffcd8b 100644 --- a/.github/workflows/google-fonts.yml +++ b/.github/workflows/google-fonts.yml @@ -57,18 +57,42 @@ jobs: - name: Import Google Fonts run: ./developer/bin/import_google_fonts vendor/google-fonts ${{ matrix.mode }} - - name: Create pull request with updated files + - name: Check for changes + id: changes-check run: | - set -euo pipefail - - if ! git diff --stat --exit-code + if git diff --stat --exit-code then - git checkout -b "auto-${{ matrix.mode }}-google-fonts" + echo "changes=false" >> "$GITHUB_ENV" + else + echo "changes=true" >> "$GITHUB_ENV" + fi - git commit -am "Update Google Fonts" -m "This pull request was created automatically by the [\`google-fonts\`](https://github.com/Homebrew/homebrew-cask/blob/master/.github/workflows/google-fonts.yml) workflow." + - name: Checkout branch + if: env.changes == 'true' + run: git checkout -b "auto-${{ matrix.mode }}-google-fonts" - gh pr create --fill --head "auto-${{ matrix.mode }}-google-fonts" - fi + - name: Create commits + if: env.changes == 'true' + run: git commit --all --message "Update Google Fonts" --message "This pull request was created automatically by the [\`google-fonts\`](https://github.com/Homebrew/homebrew-cask/blob/master/.github/workflows/google-fonts.yml) workflow." + env: + GIT_COMMITTER_NAME: ${{ steps.git-user-config.outputs.name }} + GIT_COMMITTER_EMAIL: ${{ steps.git-user-config.outputs.email }} + HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} + + - name: Push commits + if: env.changes == 'true' + uses: Homebrew/actions/git-try-push@master + with: + token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} + branch: "auto-${{ matrix.mode }}-google-fonts" + env: + GIT_COMMITTER_NAME: ${{ steps.git-user-config.outputs.name }} + GIT_COMMITTER_EMAIL: ${{ steps.git-user-config.outputs.email }} + HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} + + - name: Create pull request with updated files + if: env.changes == 'true' + run: gh pr create --fill --base master --head "auto-${{ matrix.mode }}-google-fonts" env: GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GIT_COMMITTER_NAME: ${{ steps.git-user-config.outputs.name }}