Skip to content

Commit

Permalink
google-fonts: fix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
bevanjkay committed Sep 1, 2024
1 parent eed3b40 commit 49f5fb1
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/google-fonts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 49f5fb1

Please sign in to comment.