Skip to content

Commit 1a7e0ed

Browse files
authored
Merge pull request #1 from HackPoint/copilot/fix-update-homebrew-tap-job
Make release tap update job resilient to missing TAP_PUSH_TOKEN
2 parents 4582c94 + e87c8f3 commit 1a7e0ed

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ jobs:
185185
- name: Checkout lumen (for formula templates)
186186
uses: actions/checkout@v4
187187

188+
- name: Check TAP_PUSH_TOKEN availability
189+
id: tap_token
190+
env:
191+
TAP_PUSH_TOKEN: ${{ secrets.TAP_PUSH_TOKEN }}
192+
run: |
193+
if [[ -n "$TAP_PUSH_TOKEN" ]]; then
194+
echo "configured=true" >> "$GITHUB_OUTPUT"
195+
else
196+
echo "configured=false" >> "$GITHUB_OUTPUT"
197+
echo "TAP_PUSH_TOKEN is not set; skipping Homebrew tap update."
198+
fi
199+
188200
# TAP_PUSH_TOKEN is a GitHub Personal Access Token with `repo` scope on
189201
# HackPoint/homebrew-tap. GITHUB_TOKEN is scoped to this repo and cannot
190202
# push to another repo.
@@ -197,13 +209,15 @@ jobs:
197209
# 4. HackPoint/lumen → Settings → Secrets and variables → Actions → New secret
198210
# Name: TAP_PUSH_TOKEN Value: (paste token)
199211
- name: Checkout homebrew-tap
212+
if: steps.tap_token.outputs.configured == 'true'
200213
uses: actions/checkout@v4
201214
with:
202215
repository: HackPoint/homebrew-tap
203216
token: ${{ secrets.TAP_PUSH_TOKEN }}
204217
path: homebrew-tap
205218

206219
- name: Update formulae with new version + sha256
220+
if: steps.tap_token.outputs.configured == 'true'
207221
run: |
208222
VERSION="${{ needs.build.outputs.version }}"
209223
DMG_SHA="${{ needs.build.outputs.dmg_sha256 }}"
@@ -224,6 +238,7 @@ jobs:
224238
grep -E 'version|sha256' "$FORMULA"
225239
226240
- name: Commit + push tap update
241+
if: steps.tap_token.outputs.configured == 'true'
227242
working-directory: homebrew-tap
228243
run: |
229244
VERSION="${{ needs.build.outputs.version }}"

0 commit comments

Comments
 (0)