Skip to content

ci: Skip the build and tests on docs-only PRs - #175

Merged
mpaulosky merged 2 commits into
mainfrom
squad/173-skip-ci-for-docs
Sep 30, 2026
Merged

mpaulosky merged 2 commits into
mainfrom
squad/173-skip-ci-for-docs

Conversation

@mpaulosky

@mpaulosky mpaulosky commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every release blog PR changes only documentation (docs/blogs/, README.md, docs/README.md), yet ran the full build, all eight test projects, coverage and CodeQL: about 17 runner-minutes each (#167, #169, #171). paths-ignore can't skip them, because Build Solution and Test Suite are required checks, and a check that never reports blocks the merge.

  • New Detect Changes job (ci.yml) classifies the PR's changed files. When every one is Markdown or under docs/, Build Solution, the test matrix and coverage are skipped. GitHub counts a required check skipped by its if: as passing, and pr-automerge.yml relies on GitHub's CLEAN merge state, which does the same.
  • Fails safe: any other path (workflows, scripts, .cs, project files) runs the full suite, as do pushes and manual runs. An empty diff runs it too. Renames are listed under both paths (--no-renames), so moving code into docs/ or to a .md name still runs the suite.
  • Test Suite stays honest: it still fails on any failed or cancelled job, and also when Detect Changes itself didn't succeed, so the build can't be skipped by mistake. On a docs-only PR its summary says the build and tests were skipped.
  • CodeQL ignores docs/** and **/*.md on pull_request. It isn't a required check, and main's push and weekly runs still cover the code.
  • Lint Markdown, YAML and Actions, and the Python and hook tests, still run on every PR.

Testing

  • The classification was run in a scratch repo (and --no-renames confirmed to list both paths when src/a.cs is moved to docs/a.md): a blog-PR-shaped change and docs/index.html → docs-only. A .cs file, a workflow, Markdown plus code, a file named docs.md.cs, and an empty diff → full suite.
  • yamllint, actionlint and zizmor are clean, and scripts/gate.sh passed.
  • This PR changes workflows, so its own CI takes the full-suite path.
  • The docs-only path was checked live on a throwaway draft PR that changes one doc and targets this branch (see the comments), before this PR was marked ready.

Fixes #173

🤖 Generated with Claude Code

Every release blog PR changes only documentation, yet ran the full
build, all eight test projects, coverage and CodeQL, about 17
runner-minutes each. The build and test jobs can't be left out with
paths-ignore, because Build Solution and Test Suite are required checks
and a check that never reports blocks the merge.

A new Detect Changes job classifies the PR's files. When every one is
Markdown or under docs/, the build, test matrix and coverage are
skipped, which counts as passing for a required check. Anything else,
including workflows and scripts, runs the full suite, as do pushes and
manual runs. Test Suite still fails on any failed or cancelled job, and
also when Detect Changes itself didn't succeed, so the build can't be
skipped by mistake. CodeQL's pull_request trigger ignores docs and
Markdown; main's push and weekly runs still cover the code.

Fixes #173

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Test Results Summary

483 tests  ±0   483 ✅ ±0   21s ⏱️ +7s
  9 suites ±0     0 💤 ±0 
  9 files   ±0     0 ❌ ±0 

Results for commit 7638193. ± Comparison against base commit 6d2d075.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.40%. Comparing base (6d2d075) to head (7638193).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #175   +/-   ##
=======================================
  Coverage   85.40%   85.40%           
=======================================
  Files          77       77           
  Lines        1596     1596           
  Branches      150      150           
=======================================
  Hits         1363     1363           
  Misses        189      189           
  Partials       44       44           

@mpaulosky

Copy link
Copy Markdown
Owner Author

Docs-only path checked live on #176 (a draft PR changing only docs/testing.md, targeting this branch): Detect Changes passed, Build Solution, test discovery, the test matrix and coverage were skipped, Test Suite passed, and CodeQL didn't run. This PR's own run took the full-suite path, and everything passed.

@mpaulosky
mpaulosky marked this pull request as ready for review September 30, 2026 02:20
Copilot AI balanced review requested due to automatic review settings September 30, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown

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

Rename detection can classify removal of a source or configuration path as docs-only and incorrectly skip required validation.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Adds docs-only PR detection to reduce unnecessary CI work while preserving required checks.

Changes:

  • Skips builds, tests, coverage, and CodeQL for documentation-only PRs.
  • Keeps Test Suite reporting and fail-safe status checks.
  • Adds conservative full-suite handling for other events and empty diffs.
File Description
.github/​workflows/​ci.yml Detects docs-only changes and gates expensive jobs.
.github/​workflows/​codeql-analysis.yml Excludes documentation-only PRs from CodeQL.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/ci.yml Outdated
git diff --name-only reports a rename under its new path only, so moving
a source file into docs/ or to a .md name looked docs-only and skipped
the build and tests. --no-renames lists the removed path too. Addresses
Copilot review on #175.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The workflow safely defaults to full CI and preserves required status-check behavior.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@mpaulosky
mpaulosky merged commit 1e90116 into main Sep 30, 2026
31 checks passed
@mpaulosky
mpaulosky deleted the squad/173-skip-ci-for-docs branch September 30, 2026 02:31
mpaulosky added a commit that referenced this pull request Sep 30, 2026
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
mpaulosky added a commit to mpaulosky/atelier-store that referenced this pull request Sep 30, 2026
* ci: Skip the build and tests for docs-only pull requests

A Detect Changes job classifies the PR's files. When every path is under
docs/ or ends in .md, as in a release blog PR, the build is skipped and
the test matrix and coverage skip with it. A skipped required check
counts as passing, so the PR still merges. Test Report Summary fails
if the detection itself failed. CodeQL ignores docs-only PRs too.

Port of mpaulosky/IssueTracker#175.

Refs #86

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: Classify a PR's changed files in a tested script

detect_changes.py holds the docs-only rule the Detect Changes job used to
run inline: every path under docs/ or ending in .md skips the build, and
anything else, an empty diff or a rename out of code runs it. Its tests
build real git repos to cover docs-only, code, mixed, empty, rename,
delete and odd-filename changes.

Refs #86

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Skip build and tests on docs-only PRs such as release blogs

2 participants