Skip to content

chore(ci): auto-heal vendorHash on Dependabot PRs#190

Merged
mmanciop merged 2 commits into
mainfrom
nix-vendor-hash-dependabot
Jul 16, 2026
Merged

chore(ci): auto-heal vendorHash on Dependabot PRs#190
mmanciop merged 2 commits into
mainfrom
nix-vendor-hash-dependabot

Conversation

@mmanciop

@mmanciop mmanciop commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Add nix-vendor-hash-dependabot.yml: a pull_request_target workflow that recomputes the nix/package.nix vendorHash on Dependabot PRs and pushes the fix back to the PR branch.
  • Drop Dependabot from the existing nix-vendor-hash.yml if: so the two workflows don't both fire on the same PR.

Why

Dependency bumps change go.mod/go.sum, which invalidates the buildGoModule vendorHash in nix/package.nix and turns the Nix build red on the PR. The existing nix-vendor-hash.yml workflow already fixes this for human PRs on pull_request, but GitHub withholds Actions secrets from Dependabot-triggered pull_request runs, so the PAT-based checkout fails with Input required and not supplied: token.

See the update-vendor-hash failure on PR #188 — that's the failure mode this addresses.

pull_request_target runs the workflow file from the base branch and does grant Actions secrets to Dependabot-triggered runs, so it is the supported way to push back to a Dependabot PR branch without also registering the PAT as a Dependabot secret.

Dependency bumps change go.mod/go.sum, which invalidates the
buildGoModule vendorHash in nix/package.nix and turns the Nix build red
on the PR. The existing `nix-vendor-hash.yml` workflow fixes this on
`pull_request`, but GitHub withholds Actions secrets from Dependabot-
triggered `pull_request` runs, so the PAT-based checkout fails with
"Input required and not supplied: token" (see PR #188).

Add a companion workflow on `pull_request_target`, which does grant
Actions secrets to Dependabot-triggered runs. Guard by
`actor == dependabot[bot]` and same-repo head, and drop Dependabot from
the existing workflow's `if:` so the two do not double-fire.

Security tradeoff: the job still checks out and runs `nix build` on the
PR branch while a write-scoped PAT is in the environment. Scope is
confined to Dependabot's own bumps; the remaining trust surface is a
compromised upstream dependency exfiltrating the PAT during the build.
@mmanciop
mmanciop force-pushed the nix-vendor-hash-dependabot branch from 49f10d9 to 43d4784 Compare July 16, 2026 07:41
@mmanciop mmanciop changed the title ci(nix): auto-heal vendorHash on Dependabot PRs chore(ci): auto-heal vendorHash on Dependabot PRs Jul 16, 2026
Merge the Dependabot-only sibling back into `nix-vendor-hash.yml`. A
single `pull_request_target` workflow handles both Dependabot and human
dependency PRs uniformly: `pull_request_target` grants Actions secrets
to Dependabot runs (which `pull_request` denies), and same-repo human
branches are pushable the same way.

Tradeoff: a change to this workflow on a PR branch is not exercised by
that PR — `pull_request_target` evaluates the workflow file from the
base branch. Manual runs via `workflow_dispatch` cover pre-merge
testing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mmanciop
mmanciop merged commit f17c1cc into main Jul 16, 2026
67 checks passed
@mmanciop
mmanciop deleted the nix-vendor-hash-dependabot branch July 16, 2026 07:46
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant