[object Object]

← back to Cli Printing Press

Fix docs-only test filtering (#455)

d909d6cf7da3c88f4867c270d5887ded0b3d67f0 · 2026-04-30 22:03:32 -0700 · Trevin Chow

* Fix docs-only test filtering

* Trigger tests for skill changes

Files touched

Diff

commit d909d6cf7da3c88f4867c270d5887ded0b3d67f0
Author: Trevin Chow <trevin@trevinchow.com>
Date:   Thu Apr 30 22:03:32 2026 -0700

    Fix docs-only test filtering (#455)
    
    * Fix docs-only test filtering
    
    * Trigger tests for skill changes
---
 .github/workflows/lint.yml | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 023e36ad..0cecd8bd 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -61,9 +61,45 @@ jobs:
           version: v2.11.4
           verify: false
 
+  test-changes:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    outputs:
+      needs_tests: ${{ steps.changes.outputs.needs_tests }}
+    steps:
+      - uses: actions/checkout@v6
+        with:
+          fetch-depth: 0
+
+      - name: Check whether Go tests are needed
+        id: changes
+        shell: bash
+        run: |
+          set -euo pipefail
+
+          git fetch --no-tags --prune origin "${{ github.base_ref }}"
+          mapfile -t changed < <(git diff --name-only --diff-filter=ACMR "origin/${{ github.base_ref }}...HEAD")
+
+          echo "Changed files:"
+          printf '  %s\n' "${changed[@]}"
+
+          needs_tests=false
+          for file in "${changed[@]}"; do
+            case "$file" in
+              .github/workflows/lint.yml|go.mod|go.sum|cmd/*|catalog/*|internal/*|scripts/*|skills/*|docs/SKILLS.md|testdata/*)
+                needs_tests=true
+                break
+                ;;
+            esac
+          done
+
+          echo "needs_tests=$needs_tests" >> "$GITHUB_OUTPUT"
+
   test-shard:
     name: test (${{ matrix.shard }})
     runs-on: ubuntu-latest
+    needs: test-changes
+    if: needs.test-changes.outputs.needs_tests == 'true'
     timeout-minutes: 10
     strategy:
       fail-fast: false
@@ -135,11 +171,19 @@ jobs:
 
   test:
     runs-on: ubuntu-latest
-    needs: test-shard
+    needs:
+      - test-changes
+      - test-shard
     if: ${{ always() }}
     timeout-minutes: 5
     steps:
+      - name: Skip Go tests
+        if: needs.test-changes.outputs.needs_tests != 'true'
+        run: |
+          echo "Skipping Go tests: no Go, module, CI workflow, catalog, script, skill, or testdata changes."
+
       - name: Check test shards
+        if: needs.test-changes.outputs.needs_tests == 'true'
         shell: bash
         run: |
           if [[ "${{ needs.test-shard.result }}" != "success" ]]; then

← a197d414 fix(cli): pagination cursor lookup recurses into well-known  ·  back to Cli Printing Press  ·  feat(cli): add validate-narrative subcommand to replace bash 8a548d09 →