Skip to content

Commit 84bbabc

Browse files
zereightcursoragent
andcommitted
fix: avoid untrusted checkout in Homebrew sync workflow
Run formula sync as a release-scoped job after npm publish instead of a workflow_run trigger that checked out workflow_run.head_sha with write access. Co-authored-by: Cursor <[email protected]>
1 parent cacd839 commit 84bbabc

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

‎.github/workflows/homebrew-formula.yml‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
name: Sync Homebrew Formula
22

33
on:
4-
workflow_run:
5-
workflows: ["NPM Publish"]
6-
types: [completed]
74
workflow_dispatch:
85

96
permissions:
10-
contents: write
7+
contents: read
118

129
jobs:
1310
sync:
14-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
1511
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1614
steps:
1715
- name: Checkout code
1816
uses: actions/checkout@v4
19-
with:
20-
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || '' }}
2117

2218
- name: Setup Node.js
2319
uses: actions/setup-node@v4

‎.github/workflows/npm-publish.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,26 @@ jobs:
3030
run: npm run build
3131
- name: Publish to npm
3232
run: npm publish --access public --provenance
33+
34+
sync-homebrew:
35+
needs: npm
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: write
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: "22.21.1"
47+
48+
- name: Sync formula from npm tarball
49+
run: bash scripts/sync-homebrew-formula.sh
50+
51+
- name: Commit formula update
52+
uses: stefanzweifel/git-auto-commit-action@v5
53+
with:
54+
commit_message: chore(homebrew): sync formula for release
55+
file_pattern: Formula/zereight-mcp-gitlab.rb

0 commit comments

Comments
 (0)