Skip to content

ci: fix Homebrew auto-bump (url+sha256 only, avoid PyPI 24h window) - #25

Merged
rgielen merged 2 commits into
mainfrom
fix/homebrew-bump-url-sha-only
Jul 3, 2026
Merged

ci: fix Homebrew auto-bump (url+sha256 only, avoid PyPI 24h window)#25
rgielen merged 2 commits into
mainfrom
fix/homebrew-bump-url-sha-only

Conversation

@rgielen

@rgielen rgielen commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Problem

The Homebrew auto-bump has failed on the last several releases (most recently
run for v0.1.4):

Unable to determine dependencies for "leitum==0.1.4" ...
pip install ... --uploaded-prior-to=2026-07-02T20:45:21Z ... leitum==0.1.4
Please update the resources manually.

Root cause: dawidd6/action-homebrew-bump-formula runs brew bump-formula-pr,
which for a Language::Python::Virtualenv formula auto-resolves the transitive
resource set via pip with --uploaded-prior-to = now − 24h (a Homebrew safety
window). The bump runs minutes after the release, so the just-published version
is inside the excluded window and pip cannot resolve it — the step fails every
time. The action exposes no option to disable resource resolution.

Fix

Replace the action with a small script that:

  • reads the sdist url + sha256 for the new version straight from the PyPI
    JSON API (retrying for CDN lag), and
  • rewrites only the formula's top-level url + sha256 (the first,
    2-space-indented lines; resource blocks are 4-space-indented and never match),
    then opens a PR against rgielen/homebrew-taps.

Resource blocks are intentionally left untouched — they only need regenerating
when a transitive dependency drifts, which stays a human/skill responsibility
(homebrew-tap-bump). This drops the Homebrew setup + tap-trust steps entirely
and is immune to the 24h window.

The tap has no CI, so the opened PR is verified locally (brew install --build-from-source, brew audit --strict, brew test) before merging — same
gate as today.

Test plan

  • Workflow YAML parses; extracted run script passes bash -n
  • awk targeting verified on the real formula: only the top-level url +
    sha256 change; all 22+ resource blocks untouched
  • 0.1.4 was published to the tap manually with this exact url/sha256 and
    passed brew install --build-from-source + brew audit --strict + brew test
  • Reviewer: confirm on the next release (or via workflow_dispatch with a
    tag) that the job opens a clean tap PR

🤖 Generated with Claude Code

The old action-homebrew-bump-formula step let Homebrew auto-resolve Python resources with pip's `--uploaded-prior-to = now - 24h` window, which excludes the version just published minutes earlier — so every post-release bump failed with 'Unable to determine dependencies ... update the resources manually'.

Replace it with a script that only rewrites the formula's top-level url + sha256 from PyPI (with retry for CDN lag) and opens a tap PR. Resource blocks are left intact; they are regenerated by a human via the homebrew-tap-bump skill only when transitive deps drift. This removes the Homebrew/brew-trust dependency entirely and is immune to the 24h window.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 3, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Homebrew tap bump automation to avoid Homebrew’s --uploaded-prior-to=now-24h resolution window for Python virtualenv formulae by directly fetching the new sdist url + sha256 from PyPI and opening a PR that only updates those top-level fields.

Changes:

  • Replace dawidd6/action-homebrew-bump-formula usage with an inline bash script that queries the PyPI JSON API (with retries).
  • Update the tap formula by rewriting only the top-level url and sha256, leaving resource blocks untouched.
  • Create/update a PR in rgielen/homebrew-taps via gh.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/homebrew-bump.yml Outdated
Comment thread .github/workflows/homebrew-bump.yml Outdated
Comment thread .github/workflows/homebrew-bump.yml Outdated
- Keep URL/SHA scalar with jq first(...) // "" (guards against multiple sdists / missing entries).

- Rewrite the whole url/sha256 line via awk $0= instead of sub(), avoiding awk's & replacement semantics on the interpolated URL; fail with exit 3 if either top-level line is not found so a formula-format change can't silently no-op.

- Authenticate git via 'gh auth setup-git' and clone without an embedded token, so the PAT is never placed in a remote URL or .git/config.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +33 to +35
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
TAG: ${{ github.event.workflow_run.head_branch || inputs.tag }}
Comment on lines +103 to +117
else
gh pr create \
--repo rgielen/homebrew-taps \
--base main --head "${BRANCH}" \
--title "leitum ${VERSION}" \
--body "Bumps the \`leitum\` formula \`url\` + \`sha256\` to ${VERSION} (from PyPI).

The transitive Python resource blocks were **not** regenerated. If this release changed the dependency set, regenerate them before merging (see the \`homebrew-tap-bump\` skill). The tap has no CI, so verify locally first:

\`\`\`
brew install --build-from-source rgielen/taps/leitum
brew audit --strict rgielen/taps/leitum
brew test rgielen/taps/leitum
\`\`\`"
fi
@rgielen
rgielen merged commit 7d63ec3 into main Jul 3, 2026
7 checks passed
@rgielen
rgielen deleted the fix/homebrew-bump-url-sha-only branch July 3, 2026 21:30
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.

2 participants