perf(ci): skip Go jobs for docs-only changes#727
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
329c19c to
0aeb3fc
Compare
There was a problem hiding this comment.
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
changesdetection jobs and conditionalifguards to Go-specific jobs inci.yml,lint.yml, andsecurity.yml; updatedsemantic-releaseto usealways()so it runs even when Go jobs are skipped - Added
resultgate 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.
.github/detect-go-changes.bash
Outdated
| 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 |
There was a problem hiding this comment.
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.
| needs: [changes, test, nix-build, docs] | ||
| if: >- | ||
| always() | ||
| && !contains(needs.*.result, 'failure') | ||
| && !contains(needs.*.result, 'cancelled') |
There was a problem hiding this comment.
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.
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>
a5d3771 to
1505090
Compare
There was a problem hiding this comment.
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.
Summary
.github/detect-go-changes.bash) that uses the GitHub API to classify PR/push file changes as Go-related or docs-onlyCI / Result,Lint / Result,Security / Result) per workflow that roll up all job results into a single required checkPost-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 duplicatesCodeQL (Go).closes #726