fix(ci): split pre-commit into auto-fix (local) and check-only (CI) - #384
Open
mkultraWasHere wants to merge 2 commits into
Open
fix(ci): split pre-commit into auto-fix (local) and check-only (CI)#384mkultraWasHere wants to merge 2 commits into
mkultraWasHere wants to merge 2 commits into
Conversation
…(CI) markdownlint --fix and terraform_validate both modify files on disk, which always reports "files were modified by this hook" in CI and fails the required status check. This is unfixable by committing locally because CI environments regenerate different artifacts (terraform lock hashes, .terraform/ dirs). Fix by splitting the CI run into two stages: 1. Default stage: runs all hooks except markdownlint and terraform_validate (skipped via SKIP env var) 2. Manual stage: runs markdownlint in check-only mode (no --fix) terraform_validate has no check-only counterpart — tflint already covers validation in CI. Local workflow is unchanged: `git commit` triggers auto-fix hooks as before. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates the repo’s pre-commit and CI configuration to prevent CI failures caused by hooks that legitimately modify files on disk during execution, while still enforcing lint/validation behavior in CI.
Changes:
- Split
markdownlintinto a local auto-fix hook (pre-commit stage) and a CI check-only hook (manual stage). - Skip
terraform_validatein CI viaSKIPto avoidterraform initside effects during the main pre-commit run. - Add a second CI step to run manual-stage (check-only) hooks and include its result in the autofix patch capture condition.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.pre-commit-config.yaml |
Splits markdownlint into fix vs check-only hooks and documents CI skipping for terraform validation. |
.github/workflows/pre-commit.yaml |
Adjusts CI to skip autofixing hooks in the main pre-commit run, adds a manual-stage run, and updates patch capture logic accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rpart Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
@l50 You alright with this one? Cant get clean CI checks on outstanding PRs that touch terraform files. |
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
--fix(local) and check-only (CI)terraform_validatein CI viaSKIPenv var (tflint covers validation)Problem
markdownlint --fixandterraform_validateboth modify files on disk during execution. Pre-commit reports this as "files were modified by this hook" and exits non-zero. This is unfixable by committing locally — CI regenerates different artifacts (terraform lock hashes for linux_amd64 vs local darwin_arm64,.terraform/directories).Solution
--fix(auto-fixes on commit)Test plan
pre-commit run --all-filesstill auto-fixes markdowngit committriggers auto-fix hooks as before🤖 Generated with Claude Code