Skip to content

fix: use PR workflow for homebrew tap updates - #29

Merged
mateodelnorte merged 2 commits into
mainfrom
fix/homebrew-pr-workflow
Feb 15, 2026
Merged

mateodelnorte merged 2 commits into
mainfrom
fix/homebrew-pr-workflow

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Branch protection on homebrew-tap requires changes via PR
  • Switches from direct git push to creating a branch, opening a PR, and auto-merging with squash
  • Uses gh CLI (GH_TOKEN) instead of raw git clone with token URL (GITHUB_TOKEN)

Root cause

The update-homebrew job pushes directly to main on homebrew-tap, which is blocked by repository rules requiring PRs.

Same fix already applied to gitkb-releases (gitkb/gitkb-releases#2).

Test plan

  • Next meta release triggers homebrew update
  • Formula PR is created and auto-merged on homebrew-tap

Summary by CodeRabbit

  • Chores
    • Switched to a pull request–based release flow: changes are collected into a versioned branch, a PR is created and auto-merged when needed.
    • Skips release when no changes are detected.
    • Improved release messaging and handling of preexisting branches/PRs for clearer, safer delivery.

Branch protection on homebrew-tap requires changes via PR.
Switch from direct push to creating a branch, opening a PR,
and auto-merging with squash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 15, 2026 •

Copy link
Copy Markdown

Walkthrough

Release workflow changed to create a PR-based Homebrew tap update using the gh CLI and GH_TOKEN. The workflow extracts VERSION, creates a versioned branch when changes exist, opens a PR, and auto-merges via squash; direct git push is removed.

Changes

Cohort / File(s) Summary
Release Workflow Update
.github/workflows/release.yml
Replaced direct git push with a gh-based PR flow: use GH_TOKEN, clone via gh repo clone, extract VERSION and derive BRANCH, create branch only if staged changes exist, open PR, and auto-merge via squash. Handles existing branches/PRs and updates messaging accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as Action Runner
    participant GHCLI as gh CLI
    participant Repo as Homebrew Tap Repo
    participant GitHub as GitHub API

    Runner->>GHCLI: gh repo clone homebrew-tap
    Runner->>Runner: generate/update formula (uses VERSION)
    Runner->>Runner: git add && git diff --staged
    alt staged changes exist
        Runner->>GHCLI: git checkout -b BRANCH
        Runner->>Repo: git commit changes
        Runner->>GHCLI: gh repo push origin BRANCH
        Runner->>GitHub: gh pr create (branch -> base)
        GitHub->>Runner: PR created
        Runner->>GitHub: gh pr merge --squash
        GitHub->>Repo: merge PR -> update tap
    else no changes
        Runner->>Runner: skip branch/PR steps
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped to the tap with a clever plan,
Branches sprung up where commits began.
I opened a PR, then merged it neat,
Squashed all the changes—tidy and sweet.
A carrot for CI, a hop and repeat. 🥕✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: switching from direct git push to a PR-based workflow for homebrew tap updates, addressing branch protection requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/homebrew-pr-workflow

No actionable comments were generated in the recent review. 🎉


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

@mateodelnorte mateodelnorte changed the title feat: add release-please for automated versioning fix: use PR workflow for homebrew tap updates Feb 15, 2026
@greptile-apps

greptile-apps Bot commented Feb 15, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR modifies the Homebrew tap update workflow to use a PR-based approach instead of direct pushes, accommodating branch protection requirements on the harmony-labs/homebrew-tap repository.

Key Changes:

  • Changed from direct git push to creating a feature branch, opening a PR, and setting up auto-merge
  • Switched token environment variable from GITHUB_TOKEN to GH_TOKEN for gh CLI compatibility
  • Added check to skip commits when the formula is unchanged
  • Enabled auto-squash-merge for automated PR workflow

Potential Issues:

  • Auto-merge may fail silently if branch protection requires approvals or passing checks
  • Branch creation could fail if the branch already exists from a previous failed run
  • Error handling is minimal for the multi-step PR creation and merge process

Note: The PR description mentions adding release-please files, but those were added in earlier commits (acae04f and subsequent). This PR only modifies release.yml.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - the changes are well-scoped to the Homebrew workflow
  • The change correctly implements PR-based workflow for Homebrew tap updates. One logical issue exists where auto-merge may fail silently, but this won't break the release process itself. The workflow is isolated to Homebrew formula updates and won't affect core functionality.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/release.yml Switched Homebrew tap updates from direct push to PR workflow with auto-merge. Changed token environment variable from GITHUB_TOKEN to GH_TOKEN for gh CLI.

Flowchart

flowchart TD
    A[Release workflow triggered] --> B[Download artifacts]
    B --> C[Extract version from tag]
    C --> D[Calculate checksums]
    D --> E[Generate Homebrew formula]
    E --> F{Formula changed?}
    F -->|No| G[Skip commit - formula unchanged]
    F -->|Yes| H[Clone homebrew-tap repo]
    H --> I[Create feature branch]
    I --> J[Commit formula update]
    J --> K[Push branch to origin]
    K --> L[Create PR via gh CLI]
    L --> M[Enable auto-merge with squash]
    M --> N{Branch protection met?}
    N -->|Yes| O[PR auto-merges]
    N -->|No| P[PR awaits manual approval]
Loading

Last reviewed commit: 468aac0

@greptile-apps greptile-apps 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.

1 file reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/release.yml:
- Around line 328-341: The current release job will fail if the branch or PR
already exists; update the logic around BRANCH, git push, gh pr create and gh pr
merge to be idempotent by: (1) checking for and deleting or updating an existing
remote branch named "$BRANCH" (use git ls-remote or git fetch && git rev-parse)
or push with --force-with-lease to update it; (2) before running gh pr create,
query for an existing PR for the branch (gh pr view or gh pr list --head) and if
found, update that PR (gh pr edit) instead of creating a new one; and (3) handle
an existing merged/closed PR case by recreating or opening a new branch as
needed and only attempt gh pr merge when the PR is present and mergeable; apply
these changes around the git commit/push and gh pr create/merge steps to make
the workflow re-runnable.

Comment thread .github/workflows/release.yml
- Force push branch in case it exists from a previous failed run
- Check if PR exists before creating a new one
- Gracefully handle auto-merge failure (may require approvals)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mateodelnorte
mateodelnorte merged commit c5f7327 into main Feb 15, 2026
8 checks passed
mateodelnorte added a commit that referenced this pull request Feb 15, 2026
* chore: add tests and claude code config missed from PR

Add bats tests for recursive clone (--recursive, --meta-depth) and
plugin install isolation fixes. Include claude code project config
(commands, rules, skills) and gitKB settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tests): improve robustness of bats test helpers

- Wrap cd in subshell in create_meta_bare_repo so caller's cwd is
  preserved if a git command fails mid-function
- Filter PATH by known .meta/plugins directory pattern instead of
  scanning for meta-* binaries, which could drop shared dirs like
  /usr/local/bin

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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