Skip to content

ci: harden supply-chain pins and auto-merge dependabot updates - #2

Merged
CodeSigils merged 1 commit into
mainfrom
hardening/ci-supply-chain
Aug 31, 2026
Merged

ci: harden supply-chain pins and auto-merge dependabot updates#2
CodeSigils merged 1 commit into
mainfrom
hardening/ci-supply-chain

Conversation

@CodeSigils

Copy link
Copy Markdown
Owner

Summary

Hardens the CI supply-chain posture in response to the dependabot github-actions bump (#1) that failed CI. The root cause there was that a test hardcoded the exact artifact-action commit SHAs, so any action bump broke the build. This PR fixes the underlying design flaw and enables safe, reviewable auto-merging of dependabot PRs.

Changes

1. Invariant-based supply-chain guard (test/unit/docs.test.js)

Replaces the hardcoded-SHA asserts (which tested a constant, not a property) with a guard that asserts every GitHub Action in every .github/workflows/*.yml is pinned to a full 40-character immutable commit SHA — never a mutable @v6/@main ref.

  • Failed builds from now on will be self-explanatory: "ci.yml: actions/checkout must be pinned to a full 40-character immutable commit SHA, got "v7.0.1"".
  • Routine dependabot bumps now pass CI instead of breaking it.

2. Remove drift-prone version comments (.github/workflows/ci.yml)

Drops the # v7.0.1-style inline comments on all 6 pinned actions. Dependabot updates the SHA but not the comment, so they were a stale second source of truth. The full SHA is the pin.

3. Dependabot auto-merge (dependabot-auto-merge.yml)

New workflow that auto-merges dependabot PRs once required checks are green, holding any major version bump for human review:

  • gh pr merge --auto --squash (merge-when-ready, gated on CI)
  • permissions: contents: write, pull-requests: write (required — dependabot-triggered pull_request workflows start read-only)
  • gates on update-type != version-update:semver-major
  • dependabot/fetch-metadata@25dd0e34... pinned by full SHA, consistent with repo posture

Notes for the maintainer

Auto-merge only takes effect once BOTH are configured (repo settings):

  1. Settings → General → Pull requests → "Allow auto-merge" must be ON
  2. A branch protection rule on main marking the test CI check as required (so --auto has a green gate to wait on)

publish only fires on tag push, so auto-merging to main is release-safe.

- Replace hardcoded artifact-SHA asserts with an invariant-based guard that
  every GitHub Action in every workflow is pinned to a full immutable commit
  SHA (no @v6/@main mutable refs), so dependabot bumps keep CI green.
- Drop the drift-prone inline # vX version comments; the full SHA is the
  single source of truth.
- Add dependabot-auto-merge workflow: auto-merge non-major dependabot PRs on
  green (gh pr merge --auto), holding major bumps for human review.
@CodeSigils
CodeSigils merged commit f1aaeb7 into main Aug 31, 2026
4 checks passed
@CodeSigils
CodeSigils deleted the hardening/ci-supply-chain branch August 31, 2026 08:59
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