Skip to content

feat(pre-commit-advisory): opt-in private-modules for Go module fetches - #49

Merged
blairham merged 1 commit into
mainfrom
feat/pre-commit-advisory-private-modules
Jul 30, 2026
Merged

feat(pre-commit-advisory): opt-in private-modules for Go module fetches#49
blairham merged 1 commit into
mainfrom
feat/pre-commit-advisory-private-modules

Conversation

@blairham

Copy link
Copy Markdown
Contributor

Why

Repos that fetch private pinpredict Go modules (ppkit) instead of vendoring can't run the pre-commit advisory job at all: the go-mod-tidy-repo and golangci-lint (typecheck) hooks fail with fatal: could not read Username for 'https://github.com' on the private module download. herald and covenant both dropped the job for exactly this reason, losing the advisory diff-scoped hook run + sticky PR comment on those repos — and understudy just hit the same wall when its feeds plugin added a ppkit dependency (understudy#47).

What

An opt-in private-modules boolean input, mirroring the one docker-release.yml gained in #26:

  • When true: mint a short-lived read-only pinpredict-argocd App token (BOOTSTRAP_APP_ID / BOOTSTRAP_APP_PRIVATE_KEY via secrets: inherit), install a git insteadOf rewrite for github.com/pinpredict/, and export GOPRIVATE=github.com/pinpredict/* before pre-commit runs.
  • Default false — completely inert for every existing caller (all pin @main).
  • The token lives only in the runner-local git config; it never lands in the checkout or the hook-env cache.

Caller usage

  pre-commit:
    permissions:
      contents: read
      pull-requests: write
    uses: pinpredict/.github/.github/workflows/pre-commit-advisory.yml@main
    with:
      private-modules: true
    secrets: inherit

First consumer will be understudy (restoring the advisory job its feeds-plugin PR had to drop); herald and covenant can then restore theirs too.

Repos that fetch private pinpredict Go modules (ppkit) instead of vendoring
had to drop the pre-commit advisory job entirely — the go-mod-tidy-repo and
golangci-lint hooks fail with 'could not read Username for github.com' on the
private fetch (herald and covenant both omit the job for this reason; the
understudy feeds plugin just hit it too).

Add an opt-in private-modules input mirroring docker-release.yml's: mint a
short-lived read-only pinpredict-argocd App token, install a git insteadOf
rewrite for github.com/pinpredict/, and set GOPRIVATE before the hooks run.
Callers pass private-modules: true + secrets: inherit. Default false — inert
for every existing caller.
@blairham
blairham merged commit 9957124 into main Jul 30, 2026
2 checks passed
@blairham
blairham deleted the feat/pre-commit-advisory-private-modules branch July 30, 2026 01:36
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.

1 participant