Skip to content

ci: run pre-commit on changed files for PRs, drop fail_fast, document local setup - #113

Merged
Ali-Yazdani merged 2 commits into
OWASP:masterfrom
farhanashrafdev:ci/pre-commit-changed-files
Oct 4, 2026
Merged

Ali-Yazdani merged 2 commits into
OWASP:masterfrom
farhanashrafdev:ci/pre-commit-changed-files

Conversation

@farhanashrafdev

Copy link
Copy Markdown
Contributor

Closes #112.

Changes

File Change
.github/workflows/master.yml On pull_request, pass --from-ref <base.sha> --to-ref <head.sha> to pre-commit/action so only files the PR touches are checked. Pushes to master and workflow_dispatch keep --all-files. Checkout uses fetch-depth: 0 so both refs are available.
.pre-commit-config.yaml fail_fast: false so a single CI run reports every failing hook instead of stopping at the first one.
README.md New "Running the checks locally" subsection under Contributing (pip install pre-commit, pre-commit install, pre-commit run --all-files).

Why

On #99 a one-file PR failed CI on ~80 markdownlint errors in 24 files it never touched, and because of fail_fast it took three pushes to see each hook's failure in turn. See #112 for details.

Verification

  • pre-commit run --all-files passes on this branch.
  • pre-commit run --from-ref origin/master --to-ref HEAD runs the hooks on exactly the 3 changed files and passes.
  • The workflow run on this PR itself exercises the new pull_request path.

… local setup

Closes OWASP#112.

- master.yml: on pull_request pass --from-ref base.sha --to-ref head.sha to
  pre-commit/action so only files the PR touches are checked; pushes to master
  and workflow_dispatch keep --all-files. Checkout now uses fetch-depth: 0 so
  both refs are available.
- .pre-commit-config.yaml: fail_fast false so one CI run reports every
  failing hook instead of stopping at the first.
- README.md: add "Running the checks locally" under Contributing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 4, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The local setup instructions omit the required Python 3.13 prerequisite.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Scopes PR linting to changed files while preserving full checks elsewhere and improves contributor guidance.

Changes:

  • Uses commit-range checks for pull requests.
  • Reports all failing hooks.
  • Documents local pre-commit usage.
File Description
.github/​workflows/​master.yml Selects pre-commit scope by event.
.pre-commit-config.yaml Disables fail-fast behavior.
README.md Adds local setup instructions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Updated Python command for installing pre-commit.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Ali-Yazdani
Ali-Yazdani merged commit cadef74 into OWASP:master Oct 4, 2026
1 check passed
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.

CI: pre-commit runs on all files and fails fast, so unrelated lint debt blocks contributor PRs

3 participants