Skip to content

chore(ci): pin actions to SHAs + gate dependabot auto-merge on tests#21

Merged
leMaur merged 1 commit into
mainfrom
chore/pin-actions-and-gate-auto-merge
May 25, 2026
Merged

chore(ci): pin actions to SHAs + gate dependabot auto-merge on tests#21
leMaur merged 1 commit into
mainfrom
chore/pin-actions-and-gate-auto-merge

Conversation

@leMaur
Copy link
Copy Markdown
Owner

@leMaur leMaur commented May 25, 2026

What

Two supply-chain hardening changes to the CI, following the question "is it safe to keep Dependabot auto-merge?".

1. Pin every GitHub Action to a commit SHA

All actions were tag-pinned (@v6, @2.6, …), so a force-re-tag of an upstream action (the laravel-lang attack class) could be pulled silently — and auto-merged. Now every uses: is pinned to a commit SHA with a # vX comment; Dependabot still bumps the SHA + comment.

2. Gate auto-merge on the test suite

Dependabot auto-merge previously used gh pr merge --auto, but main has no required status checks, so --auto merged as soon as the PR was mergeable — not when tests passed. The workflow now waits for the test run on the PR head SHA to finish and merges only on success (semver-minor/patch; majors stay manual).

Why not branch protection / required checks? Because pint.yml and update-changelog.yml push directly to main via git-auto-commit-action; required checks on main would block those pushes. Gating inside the workflow achieves the same guarantee without breaking the release flow.

Also normalized fetch-metadata to v3.1.0 across both packages (they had drifted).

Verification

  • All 5 workflows parse as valid YAML (yq -e); zero @v/tag refs remain — every action SHA-pinned.
  • The test/PHPStan/code-style runs on this PR exercise the pinned actions.
  • The auto-merge gate logic only runs on actual Dependabot PRs (pull_request_target + github.actor == dependabot[bot]), so it cannot be exercised by this PR — it will be proven on the next Dependabot github-actions bump.

No release/tag; CI-only change.

- Pin every GitHub Action to a commit SHA (with a version comment) so a
  malicious force-re-tag of an action cannot slip in via auto-merge.
- Rewrite dependabot-auto-merge to wait for the test suite to pass on the
  PR head SHA before merging (semver-minor/patch only; majors stay manual).
  Deliberately avoids branch protection / required status checks, which
  would block pint.yml and update-changelog.yml direct pushes to main.
- Normalize fetch-metadata to v3.1.0 across both packages.
@leMaur leMaur merged commit 62ed242 into main May 25, 2026
25 checks passed
@leMaur leMaur deleted the chore/pin-actions-and-gate-auto-merge branch May 25, 2026 19:08
@leMaur leMaur restored the chore/pin-actions-and-gate-auto-merge branch May 27, 2026 08:24
@leMaur leMaur deleted the chore/pin-actions-and-gate-auto-merge branch May 27, 2026 08:25
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