fix: open a pull request when publishing the homebrew formula - #631
Draft
NickJosevski wants to merge 1 commit into
Draft
fix: open a pull request when publishing the homebrew formula#631NickJosevski wants to merge 1 commit into
NickJosevski wants to merge 1 commit 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>
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 in
.octopus/deployment_process.oclclones the tap, commits the regenerated formula, pushes areleases/<version>branch — and stops:There is no
gh pr createand no API call. The branch lands and nothing merges it.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.DISTRIBUTION.mdalready documents this step as "Create pull request to update homebrew", so the intent was always there; the implementation just stops one call short.Change
Open the pull request over the GitHub API after the push, using the token the step already holds. A 422 mentioning already exists is treated as success, so re-running a release is harmless.
Fail loudly.
$ErrorActionPreference = "Stop", and$LASTEXITCODEis checked after eachgitcall. A clone or push failure previously left the step green.Fix the argument guard.
if (!$packageVersion || !$extractedPath)used||, PowerShell's pipeline chain operator, where-orwas meant — so the guard never evaluated as a boolean. Now[string]::IsNullOrWhiteSpace(...) -or ....Exit early when the formula is unchanged, rather than relying on the
||chain.Two corrections to earlier analysis in #541
I posted two claims in that thread that a closer look disproves:
||is genuinely wrong, but it is latent —$packageVersionand$extractedPathalways come from$OctopusParameters, so the guard never had to fire. It is not what broke the tap.--paginate,releases/2.21.3andreleases/2.21.4are both present. The step succeeds every time; it simply never opens the PR.The single defect is the missing pull request.
Testing
EOTheredoc markers balance, all five steps intactmaster, which is whatbaseis set toAuthorization: Bearerheader form avoids theSecureStringrequirement that-Authentication Bearer -TokenimposesIt wants a reviewer who can run PowerShell, and a dry run against a scratch repository before the next release. Given the step has been silently half-working for two years, I would rather flag that than imply more confidence than I have.
Follow-up
The tap has ~20 stale
releases/*branches that will never merge. Worth deleting them once a real PR flow is working, so the next failure is visible instead of hidden in the noise.🤖 Generated with Claude Code