fix: open a pull request when publishing the homebrew formula - #631
Open
NickJosevski wants to merge 2 commits into
Open
fix: open a pull request when publishing the homebrew formula#631NickJosevski wants to merge 2 commits into
NickJosevski wants to merge 2 commits into
Conversation
The deployment step cloned the tap, committed the regenerated formula and pushed a releases/<version> branch, then stopped. Nothing ever opened a pull request, so the branch sat unmerged and master kept serving an older formula. The tap has accumulated a branch per release since 0.3.2 while `brew install octopus-cli` has been stuck on 2.20.0. Open the pull request over the GitHub API once the branch is pushed, and treat "a pull request already exists" as success so re-running a release is harmless. Also make the step fail loudly rather than quietly. $LASTEXITCODE is now checked after each git call, ErrorActionPreference is Stop, and the argument guard uses -or rather than ||, which is a pipeline chain operator and was never evaluating as a boolean. Fixes #541 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Re-running a release failed at the push. The step clones master shallowly and branches from it each time, so its commit is a sibling of any existing releases/<version> rather than a descendant, and a plain push is rejected as non-fast-forward — before the already-exists handling was ever reached. Also throw with the response body. Exception.Message only ever says "Response status code does not indicate success"; the body names the field GitHub rejected. Both verified against a scratch tap under pwsh 7 on Unix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
NickJosevski
marked this pull request as ready for review
August 5, 2026 05:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #541
Root cause
The publish step clones the tap, commits the regenerated formula, pushes a
releases/<version>branch, no pr and merge happens.Confirmed against the tap: branches exist for every release from
0.3.2through2.21.4,masteris still on 2.20.0, and the only pull request ever opened is #69 — raised by hand by an external user, @jnv, in June.Change
releases/<version>. Forcing also makes a re-run update the open PR instead of failing.$ErrorActionPreference = "Stop",$LASTEXITCODEchecked after eachgitcall API errors. A clone or push failure previously left the step green.if (!$packageVersion || !$extractedPath)used||, PowerShell's pipeline chain operator, where-orwas meant, so the guard never evaluated as a boolean.||chain.Testing
Ran on pwsh 7 on Unix like the
hosted-ubuntucontainer, against a scratch tap seeded with the real formula at 2.20.0.master, correct one-line version diff, exit 0base)The first two rows are what caught the force-push bug: before it, a re-run died at the push and never reached the already-exists handling.
🤖 Generated with Claude Code