From 2080d76d1ac43e1f0cc527a5afe5f6b881c29231 Mon Sep 17 00:00:00 2001 From: Scott Converse Date: Mon, 2 Nov 2026 13:06:54 -0700 Subject: [PATCH] CI: skip the heavy jobs on docs-only changes A new "changes" job lists the changed files. When every file is docs, the other jobs skip. Skipped jobs report success, so required checks still pass. Code, workflow, skill and prompt files still run the full CI. Co-Authored-By: Claude --- .github/workflows/verify.yml | 42 ++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index dfb6c10..b10b3c4 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -5,7 +5,47 @@ on: pull_request: jobs: + # Docs-only changes start no CI run (docs get push, merge and publish only). + changes: + name: Detect code changes + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + pull-requests: read + outputs: + code: ${{ steps.diff.outputs.code }} + steps: + - id: diff + shell: bash + env: + GH_TOKEN: ${{ github.token }} + EVENT: ${{ github.event_name }} + PR: ${{ github.event.pull_request.number }} + BEFORE: ${{ github.event.before }} + SHA: ${{ github.sha }} + run: | + # code=false only when every changed file is docs. Anything unknown counts as code. + docs_re='(\.(md|mdx|rst|docx|pdf)$)|(^|/)(LICENSE|NOTICE)(\.[^/]*)?$|^docs/.*\.(png|jpe?g|svg|gif|webp|html|css)$' + keep_re='(^|/)SKILL\.md$|(^|/)(skills|agents|commands|prompts|references)/|^\.claude/' + files="" + if [ "$EVENT" = pull_request ] || [ "$EVENT" = pull_request_target ]; then + files=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --paginate --jq '.[].filename') || files="" + elif [ "$EVENT" = push ] && [ -n "$BEFORE" ] && [ "$BEFORE" != 0000000000000000000000000000000000000000 ]; then + files=$(gh api "repos/$GITHUB_REPOSITORY/compare/$BEFORE...$SHA" --jq 'if (.files | length) >= 300 then empty else .files[].filename end') || files="" + fi + code=true + if [ -n "$files" ]; then + other=$(printf '%s\n' "$files" | grep -Ev "$docs_re" || true) + kept=$(printf '%s\n' "$files" | grep -E "$docs_re" | grep -E "$keep_re" || true) + if [ -z "$other" ] && [ -z "$kept" ]; then code=false; fi + fi + echo "Changed files:"; printf '%s\n' "$files" | head -50 + echo "code=$code" | tee -a "$GITHUB_OUTPUT" + verify: + needs: changes + if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -18,5 +58,3 @@ jobs: run: python -m pip install -e ".[dev]" - name: Run release gate run: bash scripts/verify-release.sh - -