1010 - Library/Homebrew/Gemfile*
1111 push :
1212 paths :
13+ - .github/licensed.yml
1314 - .github/workflows/vendor-gems.yml
15+ - Library/Homebrew/dev-cmd/vendor-gems.rb
16+ - Library/Homebrew/Gemfile*
1417 branches-ignore :
1518 - main
1619 - master
2023 description : Pull request number
2124 required : true
2225
23- permissions :
24- contents : read
25- pull-requests : read
26+ permissions : {}
2627
2728defaults :
2829 run :
3233 vendor-gems :
3334 if : github.repository_owner == 'Homebrew'
3435 runs-on : macos-26
36+ permissions :
37+ contents : write
38+ pull-requests : read
3539 steps :
3640 - name : Set up Homebrew
3741 id : set-up-homebrew
@@ -41,22 +45,22 @@ jobs:
4145 cask : false
4246
4347 - name : Configure Git user
44- if : github.event_name == 'workflow_dispatch '
48+ if : github.event_name != 'pull_request '
4549 uses : Homebrew/actions/git-user-config@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
4650 with :
47- username : BrewTestBot
48-
49- - name : Set up commit signing
50- if : github.event_name == 'workflow_dispatch'
51- uses : Homebrew/actions/setup-commit-signing@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
52- with :
53- signing_key : ${{ secrets.BREWTESTBOT_SSH_SIGNING_KEY }}
51+ username : github-actions[bot]
5452
55- - name : Check out pull request
56- id : checkout
57- if : github.event_name == 'workflow_dispatch '
53+ - name : Prepare push target
54+ id : push-target
55+ if : github.event_name != 'pull_request '
5856 run : |
59- gh pr checkout "${PR}"
57+ if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]
58+ then
59+ gh pr checkout "${PR}"
60+ else
61+ git fetch origin "+refs/heads/${GITHUB_REF_NAME}:refs/remotes/origin/${GITHUB_REF_NAME}"
62+ git checkout --no-track -B "${GITHUB_REF_NAME}" "origin/${GITHUB_REF_NAME}"
63+ fi
6064
6165 branch="$(git branch --show-current)"
6266 echo "branch=${branch}" >> "$GITHUB_OUTPUT"
@@ -65,16 +69,16 @@ jobs:
6569 echo "gem_name=${gem_name}" >> "$GITHUB_OUTPUT"
6670 env :
6771 PR : ${{ github.event.pull_request.number || github.event.inputs.pull_request }}
68- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72+ GITHUB_TOKEN : ${{ github.token }}
6973 working-directory : ${{ steps.set-up-homebrew.outputs.repository-path }}
7074
7175 - name : Vendor Gems
7276 run : |
73- if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch " ]]
77+ if [[ "${GITHUB_EVENT_NAME}" == "pull_request " ]]
7478 then
75- brew vendor-gems --non-bundler-gems
76- else
7779 brew vendor-gems --non-bundler-gems --no-commit
80+ else
81+ brew vendor-gems --non-bundler-gems
7882 fi
7983
8084 - name : Install CMake and Licensed
9397 licensed status --config .github/licensed.yml
9498
9599 - name : Commit licence metadata changes
96- if : github.event_name == 'workflow_dispatch '
100+ if : github.event_name != 'pull_request '
97101 env :
98- GEM_NAME : ${{ steps.checkout .outputs.gem_name }}
102+ GEM_NAME : ${{ steps.push-target .outputs.gem_name }}
99103 working-directory : ${{ steps.set-up-homebrew.outputs.repository-path }}
100104 run : |
101105 if [[ -n "$(git status --porcelain -- ".licenses")" ]]
@@ -109,9 +113,9 @@ jobs:
109113 run : brew typecheck --update
110114
111115 - name : Commit RBI changes
112- if : github.event_name == 'workflow_dispatch '
116+ if : github.event_name != 'pull_request '
113117 env :
114- GEM_NAME : ${{ steps.checkout .outputs.gem_name }}
118+ GEM_NAME : ${{ steps.push-target .outputs.gem_name }}
115119 working-directory : ${{ steps.set-up-homebrew.outputs.repository-path }}
116120 run : |
117121 if [[ -n "$(git status --porcelain -- "Library/Homebrew/sorbet")" ]]
@@ -121,22 +125,13 @@ jobs:
121125 -m "Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow."
122126 fi
123127
124- - name : Generate push token
125- uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
126- id : app-token
127- if : github.event_name == 'workflow_dispatch'
128- with :
129- client-id : ${{ vars.BREW_COMMIT_CLIENT_ID }}
130- private-key : ${{ secrets.BREW_COMMIT_APP_KEY }}
131- permission-contents : write
132-
133128 - name : Push to pull request
134- if : github.event_name == 'workflow_dispatch '
129+ if : github.event_name != 'pull_request '
135130 uses : Homebrew/actions/git-try-push@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
136131 with :
137- token : ${{ steps.app-token.outputs .token }}
132+ token : ${{ github .token }}
138133 directory : ${{ steps.set-up-homebrew.outputs.repository-path }}
139- branch : ${{ steps.checkout .outputs.branch }}
134+ branch : ${{ steps.push-target .outputs.branch }}
140135 force : true
141136
142137 - name : Check vendor and RBI files are in sync
0 commit comments