Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ concurrency:
jobs:
ci:
name: CI
uses: blairham/.github/.github/workflows/go-ci.yml@2a975269ebbb74aa0b4ec96f45773d7d68cc7bcc # v0.0.3
uses: blairham/.github/.github/workflows/go-ci.yml@ed30c1599f3dae98165801429893d397069b433c # v0.0.4
with:
# The Makefile's test target: the race detector, verbose.
test-command: make test
Expand All @@ -50,7 +50,7 @@ jobs:
# classified rather than waiting for all of go-ci.
changes:
name: Changes
uses: blairham/.github/.github/workflows/go-changes.yml@2a975269ebbb74aa0b4ec96f45773d7d68cc7bcc # v0.0.3
uses: blairham/.github/.github/workflows/go-changes.yml@ed30c1599f3dae98165801429893d397069b433c # v0.0.4

# Parity is this project's entire claim, so a change that breaks it fails
# before review rather than after a merge to main.
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ jobs:
# workflow's OIDC identity.
id-token: write
attestations: write # store the provenance in the repository's attestations
uses: blairham/.github/.github/workflows/go-release.yml@2a975269ebbb74aa0b4ec96f45773d7d68cc7bcc # v0.0.3
uses: blairham/.github/.github/workflows/go-release.yml@ed30c1599f3dae98165801429893d397069b433c # v0.0.4
with:
tag: ${{ inputs.tag }}
snapshot: ${{ inputs.dry-run == true }}
# blairham/goreleaser, for homebrew_bottles (goreleaser/goreleaser#7342).
goreleaser-ref: 6b2bad9d43ac7c6469cd2607a8b79bbbcbbc4b80
test-command: make test
secrets:
# A PAT with contents:write on blairham/homebrew-tap, so the formula can
Expand Down
32 changes: 19 additions & 13 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,40 @@ changelog:
- '^test:'
- '^chore:'

# A formula, not a cask. This is a CLI binary with no bundle, no installer and
# no service; `brew test` is worth keeping, and formulae work on Homebrew for
# Linux exactly as they do on macOS — which matters here, since this binary is
# what CI runs on Linux runners.
# The formula builds from the source archive below (`brew install -s`) and
# pours bottles made from the release's darwin and linux binaries, the way
# homebrew-core ships a CLI: a formula, not a cask, and not a formula that only
# downloads a prebuilt archive. A formula rather than a cask because this is a
# CLI binary with no bundle, no installer and no service; `brew test` is worth
# keeping, and formulae work on Homebrew for Linux exactly as they do on macOS,
# which matters here, since this binary is what CI runs on Linux runners.
#
# GoReleaser marks `brews` deprecated in favor of `homebrew_casks`, on the
# grounds that formulae installing pre-compiled binaries are "hackyish" and
# were only needed because Linuxbrew could not handle casks. There is no
# announced removal date, and the Linuxbrew limitation is not our reason for
# using them.
# homebrew_bottles replaces GoReleaser's deprecated `brews`. It comes from
# blairham/goreleaser (goreleaser/goreleaser#7342), which release.yml selects
# with goreleaser-ref; official GoReleaser rejects this key. Its `install` is
# the build-from-source step and is generated from the build below (main,
# ldflags, CGO_ENABLED), so none is written here.
#
# Note there is no quarantine hook here: casks flag their downloads with
# com.apple.quarantine and need it stripped, formulae do not.
brews:
homebrew_bottles:
- name: pre-commit
ids:
- pre-commit
repository:
owner: blairham
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
directory: Formula
homepage: https://github.com/blairham/go-pre-commit
description: A fast Go reimplementation of pre-commit
license: Apache-2.0
install: |
bin.install "pre-commit"
test: |
system "#{bin}/pre-commit", "--version"

# The tarball the formula's `url` points at, for building from source.
source:
enabled: true

release:
draft: false
replace_existing_draft: true
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ The synced config files (`.golangci.yml`, `.pre-commit-config.yaml`, `.editorcon

**The repo-root `action.yml` is a public composite action.** It downloads the release binary and runs hooks — a drop-in for `pre-commit/action` with no Python setup. `aws-sso-config`, `aws-config-management`, and `ghorg` consume it in their own CI, so a breaking change to its inputs (`version`, `extra_args`, `cache`, `install-only`) breaks those repos. The `pre-commit` CI job dogfoods it against this repo.

Releases: move `CHANGELOG.md`'s `[Unreleased]` under the version, push a `v*` tag → `release.yml` calls blairham/.github's `go-release.yml`, which runs the tests, then GoReleaser (`.goreleaser.yaml`) builds, signs, and notarizes, updates `blairham/homebrew-tap`, attests provenance, and publishes the tag's CHANGELOG section as the notes; then the moving `v4` alias tag follows.
Releases: move `CHANGELOG.md`'s `[Unreleased]` under the version, push a `v*` tag → `release.yml` calls blairham/.github's `go-release.yml`, which runs the tests, then GoReleaser (`.goreleaser.yaml`) builds, signs, and notarizes, updates the `pre-commit` formula in `blairham/homebrew-tap` (a source build plus bottles of the release binaries, `homebrew_bottles`), attests provenance, and publishes the tag's CHANGELOG section as the notes; then the moving `v4` alias tag follows.

## Toolchain

- `go.mod`'s `go` directive is authoritative and must match `.tool-versions`' `golang` pin **exactly** — enforced by the `check-go-version-sync` hook from [blairham/pre-commit-hooks](https://github.com/blairham/pre-commit-hooks), pinned by `rev` in `.pre-commit-config.yaml`
- golangci-lint and gofumpt are pinned in `go.mod`'s `tool` block — invoke as `go tool <name>`, never a separately installed binary
- Keep the `golangci-lint` pre-commit `rev` and the `go.mod` tool pin in lockstep
- goreleaser is pinned in `.tool-versions`, not `go.mod`
- goreleaser is pinned in `.tool-versions`, not `go.mod`. `.goreleaser.yaml` uses `homebrew_bottles`, which only the [blairham/goreleaser](https://github.com/blairham/goreleaser) fork parses (goreleaser/goreleaser#7342): official GoReleaser rejects the config, so `release.yml` passes `goreleaser-ref` to run the fork, and a local check or snapshot needs a build of that fork
- At runtime the tool needs **git ≥ 2.31** (`ls-files --deduplicate`), the same floor as upstream; a change that uses a newer git feature must raise it in README.md and docs/parity.md too

## Key Dependencies
Expand Down
Loading