feat(ci): integrate no-runner-git-commit hook into shared CI gate#304
feat(ci): integrate no-runner-git-commit hook into shared CI gate#304JacobPEvans wants to merge 1 commit into
Conversation
Adds `_no-runner-git-commit.yml` (a reusable workflow that sparse-checks
out `scripts/check-no-runner-git-commit.sh` from
ai-assistant-instructions and runs it against the calling repo) and
wires it into `_ci-gate.yml` as a new gated check:
- new input toggle: `no_runner_git_commit` (bool, default false)
- new filter convention: `github_actions` (paths under
`.github/workflows/**` and `.github/actions/**`)
- new job: `no-runner-git-commit`, gated on `(toggle && filter)`
- added to `gate.needs` and `allowed-skips`
This is Layer 5 of the 8-PR signed-commits initiative. The hook catches
raw `git commit` / `git push` in workflow / composite-action YAML so
contributors who haven't installed pre-commit locally still get the
violation surfaced in PR checks before merge. Three canonical
alternatives surface in the failure message:
1. `_ai-action-with-signing.yml` (SSH signing for AI-driven workflows)
2. `actions/github-script` + Contents API (deterministic content)
3. `peter-evans/create-pull-request@v8` with `sign-commits: true`
The hook itself ships from JacobPEvans/ai-assistant-instructions (see
companion PR). actionlint clean on both modified files.
Assisted-by: Claude <noreply@anthropic.com>
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in, reusable CI check to enforce the “no raw git commit / git push from runners” rule across consumer repos by wiring a shared hook into the existing _ci-gate.yml pattern.
Changes:
- Added a new reusable workflow (
_no-runner-git-commit.yml) that fetches and runs the centralcheck-no-runner-git-commit.shhook against the caller repo. - Extended
_ci-gate.ymlwith ano_runner_git_commitboolean toggle plus a newgithub_actionsfilter output to conditionally run the new check. - Updated
Merge Gateaggregation (needs+allowed-skips) to include the new conditional job.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/_no-runner-git-commit.yml | New reusable workflow that checks out the caller repo, pulls the central hook script via sparse checkout, and runs it in CI. |
| .github/workflows/_ci-gate.yml | Adds an opt-in toggle and filter convention, wires the new check into the conditional-job and merge-gate aggregation pattern. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closing — this wires the script from #632 which was rejected as overkill. Source-side fixes in #26 (planetscale/ghcommit-action for the profile workflows) plus the SSH-signing composite in JacobPEvans/ai-workflows#214 cover every commit path natively without needing the CI gate this PR wires. |
Summary
Layer 5 (CI half) of the 8-PR signed-commits initiative. Wires the
check-no-runner-git-commit.shhook (added in the companion PR over inJacobPEvans/ai-assistant-instructions) into the shared CI gate soevery consumer repo catches the violation during PR validation, not
just locally via pre-commit.
Changes
.github/workflows/_no-runner-git-commit.yml— a reusableworkflow that sparse-checks out the hook script from
JacobPEvans/ai-assistant-instructions@mainand runs it against thecaller repo. Single source of truth: the script lives there; this
workflow just transports it.
.github/workflows/_ci-gate.ymlno_runner_git_commit(bool, defaultfalse— opt-in per consumer)github_actionsdocumented in the file headerno-runner-git-commit, gated on(toggle && filter)gate.needsandallowed-skipsWhat the hook catches
See the companion PR for the full allowlist. TL;DR: any raw
git commit/git pushin.github/workflows/*.ymlor.github/actions/**/action.ymloutside of:gh api repos/.../contents/...)peter-evans/create-pull-request_ai-action-with-signing.yml)gh pr/issue create/actions/github-scriptWhy a reusable workflow (not an inline job)
Consistent with the existing pattern in this repo — every conditional
check (
_nix-validate.yml,_markdown-lint.yml,_file-size.yml,_python-security.yml) is its own reusable workflow that_ci-gate.ymlcalls. Keeps
_ci-gate.ymldeclarative, isolates concurrency groups,and lets repos that don't use
_ci-gate.ymlcall the check directly.Test plan
actionlintclean on both modified filescheck-yamlpre-commit hook passes on bothfalse— no consumer gets the check until they opt in (no surprise CI breakage)git log -1 --format='%G?'→G)Companion PR
JacobPEvans/ai-assistant-instructions#632:feat(hooks): block raw git commit/push in workflow YAMLAssisted-by: Claude noreply@anthropic.com