ci: fire CI once per change and add a staged-file pre-commit gate#86
Merged
Conversation
ci.yml and skill-fixture-drift.yml fired on both push (main/dev) and pull_request, so every squash merge re-ran the same tree that the PR already verified. ci.yml drives rust-ci.yml's 6-job fan-out including a windows-latest leg billed at the 2x multiplier, so the duplicate roughly doubled cost on every merge. Both now trigger on pull_request only and carry a concurrency group keyed on workflow+ref so superseded pushes to an open PR cancel the in-flight run instead of queuing another one. skill-fixture-drift.yml's drift-check job also gets timeout-minutes now that it's confirmed not to be a reusable-workflow call.
pre-push already mirrors CI's fmt/clippy/test/deny/shellcheck gates, but nothing ran at commit time, so a bad format or lint pass only surfaced at push. The new pre-commit hook scopes to staged files only so it stays fast: cargo fmt --check when .rs is staged, markdownlint when .md is staged, shellcheck when .sh is staged (including the hooks themselves). Each tool no-ops with a notice when not installed, same as pre-push. Also documents the two-hook activation line in the README Contributing section.
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
Fleet CI-cost audit applied to this repo. This is the personal Actions pool's dominant consumer (~7,000 units this period), and its CI caller fans out to the six-job
rust-cireusable including a ×2-billed Windows job, so duplicate triggers here were the single most expensive dup in the fleet.Net diff against
dev:ci.ymlandskill-fixture-drift.ymlfire onpull_requestonly. Merges tomain/devare squash merges, so the formerpushruns re-verified trees identical to the CI-verified PR heads. Both gain aconcurrencygroup withcancel-in-progress;skill-fixture-drift's own job gainstimeout-minutes: 10(therust-cijobs are capped inside the reusable).scripts/hooks/pre-commitadds the missing fast local gate: staged-file-scopedcargo fmt --check, markdownlint, and shellcheck, complementing the existing whole-repopre-push. README documents the per-clone activation.Left CI-only by design:
cargo package --list/cargo publish --dry-run(~33 s, too heavy for a hook).Type of Change
ci: CI/CD configuration changesRelated Issues/Stories
Testing
Test Summary:
--severity=warning): clean on both hooks; pre-commit exercised against real staged diffs (fmt, markdownlint, shellcheck all fired and passed)origin/dev, unrelated to this diff: 4 failingcargo testcases locally on macOS (symlink + exit-code tests); ubuntu CI is unaffectedFiles Modified
Modified:
.github/workflows/ci.yml.github/workflows/skill-fixture-drift.ymlREADME.mdCreated:
scripts/hooks/pre-commitRenamed:
Deleted:
Benefits
Breaking Changes
Deployment Notes
Checklist