ci: harden supply-chain pins and auto-merge dependabot updates - #2
Merged
Conversation
- 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.
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
Hardens the CI supply-chain posture in response to the dependabot
github-actionsbump (#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/*.ymlis pinned to a full 40-character immutable commit SHA — never a mutable@v6/@mainref."ci.yml: actions/checkout must be pinned to a full 40-character immutable commit SHA, got "v7.0.1"".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-triggeredpull_requestworkflows start read-only)update-type != version-update:semver-majordependabot/fetch-metadata@25dd0e34...pinned by full SHA, consistent with repo postureNotes for the maintainer
Auto-merge only takes effect once BOTH are configured (repo settings):
mainmarking thetestCI check as required (so--autohas a green gate to wait on)publishonly fires on tag push, so auto-merging tomainis release-safe.