fix(release): publish Homebrew formula to tap in announce job - #14
Conversation
GITHUB_TOKEN cannot write to external repos; use HOMEBREW_TAP_TOKEN to clone robdefeo/homebrew-tap and push the generated formula.
Greptile SummaryThis PR fixes the Key changes and observations:
Confidence Score: 4/5Safe to merge after addressing the unguarded git commit that will fail the job on re-runs or unchanged formulas. The approach is correct and well-scoped. One P1 issue exists: the unguarded .github/workflows/release.yml — specifically the unguarded
|
| Filename | Overview |
|---|---|
| .github/workflows/release.yml | Adds Homebrew tap publishing step to the announce job using a PAT (HOMEBREW_TAP_TOKEN); one P1 issue — unguarded git commit will fail if the formula is unchanged. |
Sequence Diagram
sequenceDiagram
participant GHA as GitHub Actions announce job
participant VoxRelease as robdefeo/voxscribe Release
participant TapRepo as robdefeo/homebrew-tap
GHA->>VoxRelease: gh release download tag pattern .rb
VoxRelease-->>GHA: voxscribe.rb formula
GHA->>TapRepo: git clone via HOMEBREW_TAP_TOKEN
TapRepo-->>GHA: cloned repo
GHA->>GHA: cp formula to homebrew-tap/Formula/
GHA->>TapRepo: git add + commit + push
TapRepo-->>GHA: push confirmed
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .github/workflows/release.yml
Line: 307-309
Comment:
**`git commit` will fail if formula is unchanged**
If the formula file pushed to the release is byte-for-byte identical to the one already in the tap (e.g. a re-triggered workflow, or a release that didn't change the formula), `git add` will stage nothing and `git commit` will exit with code 1 ("nothing to commit"), failing the job. Guard the commit so the step only commits when there is actually a diff:
```suggestion
git add Formula/
git diff --staged --quiet || git commit -m "Update voxscribe formula to ${{ needs.plan.outputs.tag }}"
git diff --staged --quiet || git push
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: .github/workflows/release.yml
Line: 299
Comment:
**No strict error mode — silent failures possible**
The script does not start with `set -euo pipefail`. If `gh release download` fails (e.g., no `.rb` artifact exists in the release), or if `cp formula/*.rb` finds no files, subsequent commands will continue executing and may produce confusing results or an incomplete push. Adding `set -euo pipefail` as the first line of the `run` block will cause the step to fail fast on the first error.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(release): publish Homebrew formula t..." | Re-trigger Greptile
| git add Formula/ | ||
| git commit -m "Update voxscribe formula to ${{ needs.plan.outputs.tag }}" | ||
| git push |
There was a problem hiding this comment.
git commit will fail if formula is unchanged
If the formula file pushed to the release is byte-for-byte identical to the one already in the tap (e.g. a re-triggered workflow, or a release that didn't change the formula), git add will stage nothing and git commit will exit with code 1 ("nothing to commit"), failing the job. Guard the commit so the step only commits when there is actually a diff:
| git add Formula/ | |
| git commit -m "Update voxscribe formula to ${{ needs.plan.outputs.tag }}" | |
| git push | |
| git add Formula/ | |
| git diff --staged --quiet || git commit -m "Update voxscribe formula to ${{ needs.plan.outputs.tag }}" | |
| git diff --staged --quiet || git push |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/release.yml
Line: 307-309
Comment:
**`git commit` will fail if formula is unchanged**
If the formula file pushed to the release is byte-for-byte identical to the one already in the tap (e.g. a re-triggered workflow, or a release that didn't change the formula), `git add` will stage nothing and `git commit` will exit with code 1 ("nothing to commit"), failing the job. Guard the commit so the step only commits when there is actually a diff:
```suggestion
git add Formula/
git diff --staged --quiet || git commit -m "Update voxscribe formula to ${{ needs.plan.outputs.tag }}"
git diff --staged --quiet || git push
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Won't fix — .github/workflows/release.yml is autogenerated by cargo-dist; we're keeping manual additions minimal to avoid drift on regeneration.
| - name: "Publish Homebrew formula" | ||
| env: | ||
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||
| run: | |
There was a problem hiding this comment.
No strict error mode — silent failures possible
The script does not start with set -euo pipefail. If gh release download fails (e.g., no .rb artifact exists in the release), or if cp formula/*.rb finds no files, subsequent commands will continue executing and may produce confusing results or an incomplete push. Adding set -euo pipefail as the first line of the run block will cause the step to fail fast on the first error.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/release.yml
Line: 299
Comment:
**No strict error mode — silent failures possible**
The script does not start with `set -euo pipefail`. If `gh release download` fails (e.g., no `.rb` artifact exists in the release), or if `cp formula/*.rb` finds no files, subsequent commands will continue executing and may produce confusing results or an incomplete push. Adding `set -euo pipefail` as the first line of the `run` block will cause the step to fail fast on the first error.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Won't fix — same reason as above; release.yml is autogenerated by cargo-dist and we're keeping the manual step simple.
Summary
GITHUB_TOKENis scoped to the current repo and cannot push torobdefeo/homebrew-tapannouncejob was generated empty by cargo-dist with no publish step.rbformula from the release and push it to the tap usingHOMEBREW_TAP_TOKENTest plan
robdefeo/homebrew-tapcontainsFormula/voxscribe.rbbrew tap robdefeo/tap && brew install voxscribeworks