fix(ci): register local tap before brew install in formula test#126
fix(ci): register local tap before brew install in formula test#126
Conversation
brew install --build-from-source requires the formula to be part of a registered tap. The previous command passed a raw file path which Homebrew rejects. Fix: tap the cloned directory first with `brew tap <org>/<repo> <path>`, then install via the tap reference. Fixes the 'Update Homebrew Formula' workflow failure on v1.0.0 release. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the Homebrew release workflow to register the local tap clone before installing and uninstalling the formula, ensuring Homebrew accepts the formula during the CI formula test step. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
🔒 Security Analysis ReportSecurity Analysis ReportGenerated: Wed Apr 1 11:31:45 UTC 2026 Bandit Security ScanSafety Check ResultsPip-Audit Results |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- This step now relies on being run from the repo root via
$(pwd)/homebrew-tap; consider either keeping an explicitcd/working-directoryor using${{ github.workspace }}/homebrew-tapso it’s resilient to future changes in the default working directory. - The formula name
macversiontrackeris now hard-coded in the install/uninstall commands; consider deriving it fromFORMULA_PATHor a single shared variable so the workflow doesn’t silently break if the formula filename or name changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- This step now relies on being run from the repo root via `$(pwd)/homebrew-tap`; consider either keeping an explicit `cd`/`working-directory` or using `${{ github.workspace }}/homebrew-tap` so it’s resilient to future changes in the default working directory.
- The formula name `macversiontracker` is now hard-coded in the install/uninstall commands; consider deriving it from `FORMULA_PATH` or a single shared variable so the workflow doesn’t silently break if the formula filename or name changes.
## Individual Comments
### Comment 1
<location path=".github/workflows/release-homebrew.yml" line_range="75-83" />
<code_context>
+ # Register the local clone as a tap before installing —
+ # Homebrew rejects formulae that aren't referenced via a tap.
+ brew tap docdyhr/homebrew-tap "$(pwd)/homebrew-tap"
+ brew install --build-from-source docdyhr/homebrew-tap/macversiontracker
versiontracker --help
versiontracker --version
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Hardcoding the formula name here can get out of sync with `FORMULA_PATH`.
Previously this used `"./${FORMULA_PATH}"`, but now the tap/name is hardcoded. If the formula name or path changes, `FORMULA_PATH` could be updated while this line is missed. Consider deriving the full `tap/formula` reference from `FORMULA_PATH` (or another shared variable) so there’s a single source of truth.
```suggestion
- name: Test formula installation
run: |
# Register the local clone as a tap before installing —
# Homebrew rejects formulae that aren't referenced via a tap.
brew tap docdyhr/homebrew-tap "$(pwd)/homebrew-tap"
# Derive the tap/formula reference from FORMULA_PATH so there's a single source of truth.
formula_basename="$(basename "${FORMULA_PATH}")"
formula_name="${formula_basename%.rb}"
tap_name="docdyhr/homebrew-tap"
formula_ref="${tap_name}/${formula_name}"
brew install --build-from-source "${formula_ref}"
versiontracker --help
versiontracker --version
brew uninstall "${formula_ref}" || true
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - name: Test formula installation | ||
| run: | | ||
| cd homebrew-tap | ||
| brew install --build-from-source "./${FORMULA_PATH}" | ||
| # Register the local clone as a tap before installing — | ||
| # Homebrew rejects formulae that aren't referenced via a tap. | ||
| brew tap docdyhr/homebrew-tap "$(pwd)/homebrew-tap" | ||
| brew install --build-from-source docdyhr/homebrew-tap/macversiontracker | ||
| versiontracker --help | ||
| versiontracker --version | ||
| brew uninstall macversiontracker || true | ||
| brew uninstall docdyhr/homebrew-tap/macversiontracker || true |
There was a problem hiding this comment.
suggestion (bug_risk): Hardcoding the formula name here can get out of sync with FORMULA_PATH.
Previously this used "./${FORMULA_PATH}", but now the tap/name is hardcoded. If the formula name or path changes, FORMULA_PATH could be updated while this line is missed. Consider deriving the full tap/formula reference from FORMULA_PATH (or another shared variable) so there’s a single source of truth.
| - name: Test formula installation | |
| run: | | |
| cd homebrew-tap | |
| brew install --build-from-source "./${FORMULA_PATH}" | |
| # Register the local clone as a tap before installing — | |
| # Homebrew rejects formulae that aren't referenced via a tap. | |
| brew tap docdyhr/homebrew-tap "$(pwd)/homebrew-tap" | |
| brew install --build-from-source docdyhr/homebrew-tap/macversiontracker | |
| versiontracker --help | |
| versiontracker --version | |
| brew uninstall macversiontracker || true | |
| brew uninstall docdyhr/homebrew-tap/macversiontracker || true | |
| - name: Test formula installation | |
| run: | | |
| # Register the local clone as a tap before installing — | |
| # Homebrew rejects formulae that aren't referenced via a tap. | |
| brew tap docdyhr/homebrew-tap "$(pwd)/homebrew-tap" | |
| # Derive the tap/formula reference from FORMULA_PATH so there's a single source of truth. | |
| formula_basename="$(basename "${FORMULA_PATH}")" | |
| formula_name="${formula_basename%.rb}" | |
| tap_name="docdyhr/homebrew-tap" | |
| formula_ref="${tap_name}/${formula_name}" | |
| brew install --build-from-source "${formula_ref}" | |
| versiontracker --help | |
| versiontracker --version | |
| brew uninstall "${formula_ref}" || true |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Update Homebrew Formulaworkflow failed on the v1.0.0 release with: "Homebrew requires formulae to be in a tap"brew install --build-from-source "./Formula/macversiontracker.rb"passes a raw file path, which Homebrew rejectsbrew tap docdyhr/homebrew-tap $(pwd)/homebrew-tap, then install via the tap referencedocdyhr/homebrew-tap/macversiontrackerTest plan
Update Homebrew Formulavia workflow_dispatch after merge to verify🤖 Generated with Claude Code
Summary by Sourcery
CI: