ci(packaging): lint the Homebrew cask on pull requests - #52
Merged
Merged
Conversation
brew style / brew audit only ran in publish-packages.yml's homebrew job, after a release is published, so a template change that broke one of Homebrew's rules merged cleanly and failed in the publish run. That is how the Homebrew/OSDependsOn offense from #49's fix blocked the 0.13.3 republish (fixed in #50). verify-homebrew.yml runs the same lint on PRs that touch the cask template, the renderer or the lint itself, and on dispatch, against the latest published release. The steps (brew update, register the rendered cask as the jpicklyk/logtapper tap, brew style, brew audit --online) move into a composite action, .github/actions/homebrew-lint, which the publish job now uses too, so the two cannot drift. brew update now runs before the tap is registered, so it no longer fetches into the publish job's tap checkout. The PR check renders with the real DMG hashes: --online implies a download that is checked against the cask's sha256. Only the NSIS hash, which the cask does not use, is a dummy. It pushes nothing and uses no PAT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # packaging/README.md
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.
Summary
brew style/brew auditonly ran inpublish-packages.yml'shomebrewjob, after a release is published, so a template change that broke one of Homebrew's rules merged cleanly and first failed in the publish run. That is how theHomebrew/OSDependsOnoffense from #49's fix blocked the 0.13.3 republish (fixed in #50)..github/workflows/verify-homebrew.yml(new) runs onmacos-latestfor PRs that touchpackaging/homebrew/**,scripts/render-packaging.mjs, the lint action or the workflow itself, and onworkflow_dispatch(optionalversion, default latest release). It resolves the latest release the wayverify-chocolatey.ymldoes, renders the cask, and runs the lint. It pushes nothing and uses no PAT or tap checkout..github/actions/homebrew-lint(new composite action) holds the shared steps:brew update, copy the rendered cask into a directory and symlink that directory in as thejpicklyk/logtappertap,brew style --cask, thenbrew audit --cask --onlinewithHOMEBREW_GITHUB_API_TOKEN. The publish job now calls it too, so the PR check and the release gate cannot drift.packaging/README.mddescribes the lint, the PR check and what it does not cover.Things worth checking
--onlineimplies a download incask/audit.rb(download ||= online || signing), andDownload#fetchverifies the checksum. Soverify-chocolatey.yml's dummy-DMG-hash trick would fail the audit here. Only the NSIS hash, which the cask does not use, is a dummy. That skips one download and keeps the linted cask byte-identical to what publish would push for that version.brew updatenow runs before the tap is registered (before this PR it ran after). This keeps it from fetching into the publish job's tap checkout. The lint result is unchanged.:catalina, still fails an unchanged template in the next publish run first. Dispatching the workflow checks the latest release against current Homebrew. A weeklyscheduletrigger would close that gap if wanted.Test plan
Verify Homebrew caskpasses on this PR, which touches the workflow and the action. This is the first time the composite action runs, and the first time the tap is a plain directory rather than a git checkout.tap-dir: tappointing at thehomebrew-logtappercheckout.🤖 Generated with Claude Code