ci: skip the build jobs for pull requests that only change Markdown or docs/ (#34)

docs/features.md still counts as code (a test checks it against the catalogue). Pushes to main
and manual runs always run every job.


Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

Co-authored-by: jyviko <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-13 19:43:36 -04:00
1 parent 0e97f8dd1d
commit c686cbd531
1 file changed
+39
+39
View File
@@ -17,8 +17,45 @@ env:
CARGO_TERM_COLOR: always
jobs:
# Pull requests that only touch Markdown or docs/ skip the build jobs (they still report, as
# skipped). Pushes to main and manual runs always run everything.
changes:
name: Select checks
runs-on: ubuntu-24.04
outputs:
code: ${{ steps.paths.outputs.code }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- id: paths
name: Detect code changes
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [ "$EVENT_NAME" != "pull_request" ]; then
echo "code=true" >> "$GITHUB_OUTPUT"
exit 0
fi
changed=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
code=false
while IFS= read -r f; do
case "$f" in
docs/features.md) code=true ;;
*.md|docs/*) ;;
"") ;;
*) code=true ;;
esac
done <<< "$changed"
echo "code=$code" >> "$GITHUB_OUTPUT"
echo "code changes: $code"
ci:
name: cargo xtask ci
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
@@ -32,6 +69,8 @@ jobs:
advisories:
name: Dependency advisories and sources
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 20
steps: