fix(ci): correctly skip code CI for docs-only PRs (#6800)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Vulnerability Scan / Detect changes (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled

dorny/paths-filter treats exclusion-only patterns as matching every
non-excluded path under the default "some" quantifier, so docs-only
PRs still set code=true. Add an explicit "**" include and use
predicate-quantifier: every in tests, type-checker, and linter.

Also gate Vulnerability Scan the same way on pull_request while
keeping schedule and main push runs unconditional.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
This commit is contained in:
Rip&Tear
2026-08-04 20:30:13 +08:00
committed by GitHub
parent b10c4ffcdc
commit 98668c6f17
4 changed files with 47 additions and 0 deletions

View File

@@ -12,8 +12,40 @@ permissions:
contents: read
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.set.outputs.code }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
if: github.event_name == 'pull_request'
- uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 # v3
id: filter
if: github.event_name == 'pull_request'
with:
# Exclusion-only patterns match every non-excluded file under the
# default "some" quantifier. Require all patterns (including "**")
# so docs-only / markdown-only PRs correctly set code=false.
predicate-quantifier: every
filters: |
code:
- '**'
- '!docs/**'
- '!**/*.md'
- name: Set code output
id: set
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "code=true" >> "$GITHUB_OUTPUT"
else
echo "code=${{ steps.filter.outputs.code }}" >> "$GITHUB_OUTPUT"
fi
pip-audit:
name: pip-audit
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1