Skip to content

fix(homebrew): update bump workflow for cli layout#106

Merged
tkhwang merged 1 commit into
mainfrom
fix/cli-path
Jun 17, 2026
Merged

fix(homebrew): update bump workflow for cli layout#106
tkhwang merged 1 commit into
mainfrom
fix/cli-path

Conversation

@tkhwang

@tkhwang tkhwang commented Jun 17, 2026

Copy link
Copy Markdown
Owner
  • Checkout source code in homebrew-bump workflow
  • Copy formula template before stamping URL/SHA
  • Add test to ensure homebrew formula template tracks cli layout

The homebrew bump workflow was failing because it was not checking out the source code, which prevented it from finding the formula template. Additionally, the formula template was not being copied before the URL and SHA were stamped, leading to incorrect formula generation.

This change also adds a test to ensure that the homebrew formula template correctly reflects the new CLI layout, preventing future regressions.

Summary by CodeRabbit

  • Tests

    • Added verification test for Homebrew packaging integration.
  • Chores

    • Updated automated Homebrew package release workflow to improve template-based deployment process.

- Checkout source code in homebrew-bump workflow
- Copy formula template before stamping URL/SHA
- Add test to ensure homebrew formula template tracks cli layout

The homebrew bump workflow was failing because it was not checking out
the source code, which prevented it from finding the formula template.
Additionally, the formula template was not being copied before the URL
and SHA were stamped, leading to incorrect formula generation.

This change also adds a test to ensure that the homebrew formula
template correctly reflects the new CLI layout, preventing future
regressions.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Homebrew bump workflow gains a new step that checks out the release source tag into a workbranch/ directory, then copies workbranch/packaging/homebrew/workbranch.rb into the tap's Formula/workbranch.rb before applying URL and SHA256 substitutions. A new shell test verifies both the formula template content and the workflow copy step.

Changes

Homebrew Formula Template-Based Bump

Layer / File(s) Summary
Source checkout and template-copy in bump workflow
.github/workflows/homebrew-bump.yml
Adds a "Checkout source" step checking out the released tag into workbranch/. Replaces direct formula editing with a cp from workbranch/packaging/homebrew/workbranch.rb into homebrew-tap/Formula/workbranch.rb, redefining FORMULA_PATH before URL/sha256 substitution runs.
Shell test for formula template and workflow integration
apps/workbranch-cli/tests/cases/release-config.sh
Adds test_homebrew_formula_template_tracks_cli_layout which reads the formula template and bump workflow, asserting the template contains moved CLI build/install paths and that the workflow includes the cp "$FORMULA_TEMPLATE" "$FORMULA_PATH" step.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • tkhwang/workbranch#6: Modifies the same .github/workflows/homebrew-bump.yml file to update the tap formula by copying a local formula template and rewriting url/sha256 before committing.

Poem

🐰 Hop, hop, hooray for templates anew,
No more editing formulas out of the blue!
We checkout the source with a checkout step,
Copy the .rb file — no skipping, no prep.
SHA and URL get stamped with care,
A tidy tap formula, fresh as spring air! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating the homebrew bump workflow to work with the new CLI layout by adding source checkout and formula template copying steps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cli-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/workbranch-cli/tests/cases/release-config.sh (1)

84-90: ⚡ Quick win

Assert workflow ordering, not just presence.

This test currently verifies both lines exist, but not that the template copy happens before stamping, so it can miss the regression described in the failure message.

Suggested patch
 expected_workflow_lines = [
     'FORMULA_TEMPLATE="workbranch/packaging/homebrew/workbranch.rb"',
     'cp "$FORMULA_TEMPLATE" "$FORMULA_PATH"',
 ]
 missing_workflow_lines = [line for line in expected_workflow_lines if line not in workflow]
 if missing_workflow_lines:
     raise SystemExit(f'Homebrew bump workflow must copy the formula template before stamping URL/SHA: {missing_workflow_lines}')
+
+copy_idx = workflow.find('cp "$FORMULA_TEMPLATE" "$FORMULA_PATH"')
+stamp_idx = workflow.find("python3 - <<'PY'")
+if copy_idx == -1 or stamp_idx == -1 or copy_idx > stamp_idx:
+    raise SystemExit('Homebrew bump workflow must copy formula template before URL/SHA stamping step')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/workbranch-cli/tests/cases/release-config.sh` around lines 84 - 90, The
test currently only verifies that the FORMULA_TEMPLATE assignment and cp command
lines exist somewhere in the workflow list, but does not enforce that they
appear in the correct order before the stamping operations. Instead of using a
simple membership check with the `missing_workflow_lines` list comprehension,
find the actual indices of the template-related lines (FORMULA_TEMPLATE and cp)
and any stamping operations in the workflow list, then verify that the template
copy operations occur at earlier indices than the stamping operations to ensure
the ordering constraint is satisfied.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/workbranch-cli/tests/cases/release-config.sh`:
- Around line 84-90: The test currently only verifies that the FORMULA_TEMPLATE
assignment and cp command lines exist somewhere in the workflow list, but does
not enforce that they appear in the correct order before the stamping
operations. Instead of using a simple membership check with the
`missing_workflow_lines` list comprehension, find the actual indices of the
template-related lines (FORMULA_TEMPLATE and cp) and any stamping operations in
the workflow list, then verify that the template copy operations occur at
earlier indices than the stamping operations to ensure the ordering constraint
is satisfied.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0cc78824-99c9-47fe-8fee-41d05436c6d5

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc3e50 and b58b78d.

📒 Files selected for processing (2)
  • .github/workflows/homebrew-bump.yml
  • apps/workbranch-cli/tests/cases/release-config.sh

@tkhwang tkhwang merged commit 549ece2 into main Jun 17, 2026
3 checks passed
@tkhwang tkhwang deleted the fix/cli-path branch June 17, 2026 13:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b58b78dbe0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

PY
}

test_homebrew_formula_template_tracks_cli_layout() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register the new Homebrew release test

This regression test is only defined, but the test runner invokes cases via explicit run_test ... calls and there is no run_test test_homebrew_formula_template_tracks_cli_layout entry in apps/workbranch-cli/tests/run.sh. As a result, ./apps/workbranch-cli/tests/run.sh never executes the new Homebrew formula/workflow guard, so the intended regression coverage is inert until this test is added to main() with the other release-config checks.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant