Skip to content

perf(ci): skip Go jobs for docs-only changes#727

Merged
cpcloud merged 2 commits intomainfrom
worktree-starry-dreaming-dongarra
Mar 9, 2026
Merged

perf(ci): skip Go jobs for docs-only changes#727
cpcloud merged 2 commits intomainfrom
worktree-starry-dreaming-dongarra

Conversation

@cpcloud
Copy link
Owner

@cpcloud cpcloud commented Mar 9, 2026

Summary

  • Add shared detection script (.github/detect-go-changes.bash) that uses the GitHub API to classify PR/push file changes as Go-related or docs-only
  • Skip Go-specific jobs (build, test, benchmarks, nix build, linters, security scans) when only docs/website paths change
  • Add gate jobs (CI / Result, Lint / Result, Security / Result) per workflow that roll up all job results into a single required check
  • Always-run jobs (Docs Build, Pre-commit, Secret Scan) are unaffected
  • Detection is intentionally conservative: unknown/new file types trigger Go CI

Post-merge action: Update the repo ruleset (ID 12645641) to require only the 3 gate jobs instead of the current 13 individual check names. Remove the redundant CodeQL (integration 57789) entry that duplicates CodeQL (Go).

closes #726

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.35%. Comparing base (b8b8697) to head (1505090).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cpcloud cpcloud force-pushed the worktree-starry-dreaming-dongarra branch 2 times, most recently from 329c19c to 0aeb3fc Compare March 9, 2026 17:43
@cpcloud cpcloud requested a review from Copilot March 9, 2026 21:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes CI performance by skipping Go-specific jobs (build, test, benchmarks, nix build, linters, security scans) when only documentation and website files are changed. It introduces a shared detection script and gate jobs to consolidate required status checks from 13 individual jobs down to 3.

Changes:

  • Added .github/detect-go-changes.bash — a shared script that classifies PR/push file changes as Go-related or docs-only using the GitHub API, with conservative fallback (unknown file types trigger Go CI)
  • Added changes detection jobs and conditional if guards to Go-specific jobs in ci.yml, lint.yml, and security.yml; updated semantic-release to use always() so it runs even when Go jobs are skipped
  • Added result gate jobs (CI / Result, Lint / Result, Security / Result) in each workflow to aggregate job outcomes into single required checks for branch protection

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
.github/detect-go-changes.bash New shared script that detects Go-related vs docs-only changes using GitHub's PR files and compare APIs
.github/workflows/ci.yml Added change detection, conditional Go job execution, updated semantic-release dependencies/condition, and gate job
.github/workflows/lint.yml Added change detection, conditional Go lint jobs, and gate job
.github/workflows/security.yml Added change detection, conditional security scan jobs, and gate job

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if [ "$event_name" != "pull_request" ]; then
file_count=$(echo "$changed" | wc -l)
if [ "$file_count" -ge 300 ]; then
echo "::warning::Compare API file cap hit ($file_count files), assuming Go changes" >&2
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

The ::warning:: annotation is redirected to stderr via >&2, but GitHub Actions only processes :: workflow commands from stdout. This means the warning will not appear as an annotation in the GitHub Actions UI. Remove the >&2 redirect to make the warning visible as an annotation, or remove the ::warning:: prefix if stderr output was intentional.

Copilot uses AI. Check for mistakes.
Comment on lines +229 to +233
needs: [changes, test, nix-build, docs]
if: >-
always()
&& !contains(needs.*.result, 'failure')
&& !contains(needs.*.result, 'cancelled')
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

The always() condition allows semantic-release to run even when test and nix-build are skipped (docs-only changes). Previously, semantic-release required these jobs to succeed. While in practice docs:-type commits won't trigger a release (the default @semantic-release/commit-analyzer only releases for feat, fix, perf), any mistakenly categorized commit (e.g., feat: update docs) would publish a release without Go tests having run. Consider adding && (needs.changes.outputs.go != 'true' || needs.test.result == 'success') to ensure that when Go changes are present, tests must pass before a release can happen.

Copilot uses AI. Check for mistakes.
cpcloud and others added 2 commits March 9, 2026 18:08
Add a shared detection script (.github/detect-go-changes.bash) that
uses the GitHub API to classify changed files. Go-specific jobs (build,
test, lint, security scans) are skipped when only docs/website paths
change. Each workflow gets a gate job (CI/Lint/Security / Result) that
rolls up all job results into a single required check.

After merging, the repo ruleset needs updating to require only the three
gate jobs instead of the current 13 individual check names.

closes #726

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… success

Send ::warning:: to stdout (not stderr) so GitHub Actions renders it as
an annotation. Gate semantic-release on test and nix-build success when
Go changes are present, preventing releases without passing tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 9, 2026 22:08
@cpcloud cpcloud force-pushed the worktree-starry-dreaming-dongarra branch from a5d3771 to 1505090 Compare March 9, 2026 22:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cpcloud cpcloud merged commit e9c6587 into main Mar 9, 2026
27 checks passed
@cpcloud cpcloud deleted the worktree-starry-dreaming-dongarra branch March 9, 2026 22:24
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.

perf(ci): skip Go CI for docs-only changes

2 participants