A path-filtered workflow that executes a repository script outside its own
on.<event>.paths (or inside on.<event>.paths-ignore) will not run when that
script is edited. A broken change to the script then merges without exercising
the workflow that depends on it.
Enable this opt-in rule to verify that every repository script invoked by a
path-filtered workflow falls inside that workflow's path filters. Configure
options.scriptDirs with the exact repository-relative script directories to
track; no directory names are hardcoded.
The rule scans direct workflow files under .github/workflows/*.yml and
.github/workflows/*.yaml that declare paths or paths-ignore on any
checked event (push, pull_request, or pull_request_target). Workflows
without path filters stay silent.
For each path-filtered workflow, the rule parses every job run step with the
shared shell parser and follows local composite actions (uses: ./...) up to
four levels deep. A deeper composite, or a shell command nested more than four
levels, is unanalyzable. It collects repository script invocations inside the
configured scriptDirs:
- Direct path execution (for example
./scripts/check.shortools/ci/lint.sh), resolved against workflow, job, and stepworking-directoryas well as literalcdand directory stack commands in the same step. Directory changes in a pipeline stay in the pipeline unless the shell runs the last stage in the parent shell, as Zsh and KornShell do. Bash does so only whenlastpipeis enabled and job control is off. Only a plain top-level Bash command can establish a new option setting. Changes inside short-circuit lists, conditional statements, or other compound commands are unanalyzable. Unresolved Bash options and explicit job control can also make pipeline directory changes unanalyzable. Commands whose directory is still known continue to be checked. Quoted variadic arguments such as"$@"can change shell options. The check follows directory changes inside a brace group or a pipedif, loop (while,until,for), orcasestage and keeps Bash subshell changes local to that subshell. It reports an uncertain directory when Bash handles a possiblepushdfailure, when a dynamicdirsargument can clear the stack, or when it cannot prove the target of a stack removal or rotation. In Bash,cd scripts || :can continue from either directory and produce an advisory. Withcd scripts || exit 1, later commands can run only fromscripts, so the check uses that directory. Substitutions used as directory operands run in the directory in effect before the change. - Script interpreter and runner invocations (
bash,sh,zsh,dash,ash,ksh,source,.,node,tsx,ts-node,bun,deno,python,python3,ruby,perl,pwsh,npx,pnpx,pnpm exec,npm exec,yarn exec, anduv run), plus nestedbash -c/sh -c/zsh -cliteral scripts and$(...)/ backtick command substitutions. The step'sshelltakes precedence over the job and workflow defaults.
Each resolved script path is evaluated against every checked path-filtered
event on that workflow using ordered gitignore-style glob matching (including
! negations on paths). GitHub's ? and + quantifiers are not that
matcher, and brace patterns are unsupported. These patterns are unanalyzable.
paths-ignore is
exclusion-only, so the remediation tells you to narrow the ignore or switch to
paths. When any path-filtered event fails to cover the script, the
rule reports the invocation line (or the uses: line for a script run inside a
local composite action) and names the missing event filters.
When a workflow cannot be proven statically—invalid YAML, unreadable bytes,
YAML merge keys or unrecognized on: / paths: shapes, dynamic paths
expressions, unsupported extended globs, GitHub ? or + quantifiers, dynamic
command names, eval, dynamic or clustered bash -c, dynamic script paths
under scriptDirs, dynamic working-directory, cd, ts-node --cwd/--dir,
or package-runner directory changes this check cannot model, unterminated shell
syntax, nesting
past four levels, unreadable local composite actions, a non-string run inside
a local composite action, or a nested ./ action that is dynamic or cannot be
resolved—the rule abstains from reporting a pass and records an unanalyzable
diagnostic governed by options.unanalyzable (default advise).
A literal directory prefix still leaves a dynamic script path unanalyzable.
For example, with scriptDirs: [scripts], node "other/${FILE}.sh" can
reach scripts/ if the expansion contains ../scripts/. The current
fallback also reports expansions such as ${#name} in that position.
options.scriptDirs defaults to [], so the rule reports nothing until
configured. Invalid entries (blank strings, absolute paths, backslashes, ..,
glob wildcards, or duplicates), invalid include globs, or unknown
events fail at configuration load.
| Option | Default | Behavior |
|---|---|---|
scriptDirs |
[] |
Repository-relative literal script directories (for example ["scripts", "tools/ci"]). Empty list disables reporting. |
include |
[] |
Optional repo-relative globs narrowing direct workflow files under .github/workflows/*.{yml,yaml}. |
events |
[] |
Optional subset of push, pull_request, pull_request_target to check. Empty checks all three when path-filtered. |
unanalyzable |
advise |
Controls diagnostics for unprovable triggers or scripts (advise, report, or ignore). |
rules:
- rule: github-actions-workflow-script-paths
scope: repository
options:
scriptDirs:
- scripts
- tools/ciEvery script invoked from scripts/ and tools/ci/ matches on.pull_request.paths.
Commands that only print a path without executing it stay silent:
# .github/workflows/ci.yml
name: CI
on:
pull_request:
paths:
- "apps/**"
- "scripts/**"
- "tools/ci/**"
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
./scripts/check.sh
node scripts/verify.mjs
pnpm exec tsx tools/ci/lint.tson.pull_request.paths covers only apps/**, so editing scripts/check.sh or
tools/ci/lint.ts does not trigger the workflow:
# .github/workflows/ci.yml
name: CI
on:
pull_request:
paths:
- "apps/**"
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
./scripts/check.sh
pnpm exec tsx tools/ci/lint.tsAdd the script path or its script directory to every path-filtered event on the
workflow (or remove the exclusion from paths-ignore):
# .github/workflows/ci.yml
name: CI
on:
pull_request:
paths:
- "apps/**"
- "scripts/**"
- "tools/ci/**"
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
./scripts/check.sh
pnpm exec tsx tools/ci/lint.tsUse a YAML comment on or above the reported invocation or uses: line, or at
the top of the workflow file:
# no-mistakes-disable-next-line github-actions-workflow-script-paths# no-mistakes-disable-line github-actions-workflow-script-paths# no-mistakes-disable-file github-actions-workflow-script-paths
Directives apply to both uncovered-script findings and unanalyzable
advisories.
# .github/workflows/ci.yml
steps:
- run: |
# no-mistakes-disable-next-line github-actions-workflow-script-paths
./scripts/manual-helper.sh- Runs at
maxonly. Configuringeffort: lowrecords a warning and runs atmax.
- Invalid YAML, non-UTF-8 bytes, YAML merge or non-string keys in root or
on:, unrecognizedon:/paths:/paths-ignore:shapes, dynamicpathsexpressions or unsupported extended globs, dynamic commands,eval, dynamicbash -c(including clustered forms such asbash -ce), dynamic script paths underscriptDirs(including an expansion in the middle of a path segment), dynamicworking-directory,cd -when the previous directory is unknown,cdoptions this check cannot model, package-runner directory flags such aspnpm --dir, unquoted shell filename patterns such asscripts/*.sh, acdinsideif/while/for/case, arunstep whoseshellthis check cannot parse, embedded**such aspre**post, unterminated shell syntax, composite or shell nesting past four levels, unreadable or malformed local composite actions, jobs that call a local reusable workflow (jobs.<id>.uses: ./...), and localuses: ./...paths that leave the repository never pass silently; they emit a diagnostic governed byoptions.unanalyzable(defaultadvise).
github-actions-run-command-policyshares the same workflow shell parser to check command flags and arguments.vitest-ci-path-coveragechecks Vitest project globs against path-filter action maps.github-actions-local-action-checkoutverifies local composite actions are preceded by a covering checkout.
Workflow bytes that are not valid UTF-8 cannot be parsed safely and produce an
unanalyzable diagnostic on the line of the first invalid byte.