Skip to content

Commit

Permalink
ci: fix bump-formula-pr action (#1025)
Browse files Browse the repository at this point in the history
This commit changes the bump-formula-pr action to directly call `brew
bump-formula-pr` for creating a PR to bump a formula.

The previous action didn't work for GitHub Apps as it used a user-only
API for determining the commit name and email. For now, these fields are
hardcoded for the @grafana-alloybot app.

Closes #965
  • Loading branch information
rfratto authored Jun 11, 2024
1 parent 7aca045 commit 96aa51c
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/bump-formula-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
owner: grafana
repositories: alloy,homebrew-grafana

# These need to be hard-coded to the bot being used; ideally in the future
# we can find a way to automatically determine this based on the token.
- name: Setup Git
run: |
git config --global user.name "grafana-alloybot[bot]"
git config --global user.email "879451+grafana-alloybot[bot]@users.noreply.github.com"
- name: Get latest release
uses: rez0n/actions-github-release@main
id: latest_release
Expand All @@ -24,19 +31,23 @@ jobs:
repository: "${{ github.repository }}"
type: "stable"

- name: Update Homebrew formula
if: 'steps.latest_release.outputs.release_id == github.event.release.id'
uses: dawidd6/action-homebrew-bump-formula@v3
- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
# Required, custom GitHub access token with the 'public_repo' and 'workflow' scopes
token: ${{ steps.app-token.outputs.token }}
# Optional, defaults to homebrew/core
tap: grafana/grafana
# Formula name, required
formula: alloy
# Optional, will be determined automatically
tag: ${{github.ref}}
# Optional, will be determined automatically
revision: ${{github.sha}}
# Optional, if don't want to check for already open PRs
force: false # true

- name: Tap Grafana formula repository
run: brew tap grafana/grafana

- name: Update Homebrew formula
if: 'steps.latest_release.outputs.release_id == github.event.release.id'
run: |
brew bump-formula-pr \
--no-browse \
--no-audit \
--no-fork \
--url https://github.com/grafana/alloy/archive/refs/tags/${{ github.ref_name }}.tar.gz \
grafana/grafana/alloy
env:
HOMEBREW_DEVELOPER: "1"
HOMEBREW_GITHUB_API_TOKEN: ${{ steps.app-token.outputs.token }}

0 comments on commit 96aa51c

Please sign in to comment.