Commit 56883b1
ci(release): auto-open Homebrew/core bump PR after npm publish (#2087)
* ci(release): auto-open Homebrew/core bump PR after npm publish
Adds a homebrew job to the Publish workflow that, after the npm publish and GitHub release are finalized, derives the version from the release tag, waits for the npm tarball to propagate, computes its sha256, and runs 'brew bump-formula-pr' to open a Homebrew/core update PR. This keeps the Homebrew formula from lagging behind GitHub/npm releases.
The step is gated on a maintainer-provisioned HOMEBREW_BUMP_TOKEN secret (a PAT with public_repo scope; the default GITHUB_TOKEN cannot open cross-repo PRs) and is a no-op warning when the secret is absent. Untrusted workflow_run data is passed via env vars and the tag is validated, per the project's GitHub Actions script-injection guidance.
Closes #2074
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(ci): harden Homebrew bump job (success gate, brew PATH, least privilege)
Address review findings on the new homebrew job:
- The custom `if:` replaced the implicit `needs: publish` success gate, so
the job could still run when publish failed after the npm tarball already
existed (e.g. `gh release edit` failing) — opening a Homebrew/core PR that
references an unpublished draft release. Add `success()` to restore the gate.
- GitHub-hosted runners ship Homebrew preinstalled but do not add it to PATH,
so `brew bump-formula-pr` would fail with command-not-found. Load Homebrew's
shell environment via `brew shellenv` before invoking brew.
- Scope the job to `permissions: {}`; it only opens a cross-repo PR with its
own HOMEBREW_BUMP_TOKEN and needs none of the workflow-level contents/id-token
grants.
Allowlist `linuxbrew` and `shellenv` in cspell for the new shellenv command.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: dyoshikawa <yoshikawa.daio@classmethod.jp>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 66129b9 commit 56883b1
2 files changed
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| 278 | + | |
277 | 279 | | |
278 | 280 | | |
279 | 281 | | |
| |||
0 commit comments