fix: use PR workflow for homebrew tap updates - #29
Conversation
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>
WalkthroughRelease workflow changed to create a PR-based Homebrew tap update using the Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
Greptile OverviewGreptile SummaryThis PR modifies the Homebrew tap update workflow to use a PR-based approach instead of direct pushes, accommodating branch protection requirements on the Key Changes:
Potential Issues:
Note: The PR description mentions adding release-please files, but those were added in earlier commits (acae04f and subsequent). This PR only modifies Confidence Score: 4/5
|
| 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]
Last reviewed commit: 468aac0
There was a problem hiding this comment.
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.
- 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>
* 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>
Summary
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
Summary by CodeRabbit