GitHub Actions Path Filters: Fix Pending Required Checks
Fix GitHub Actions checks stuck pending after a path-filtered workflow is skipped. Keep a required gate, skip only optional work, and cover merge queues.
A path filter can skip the workflow that produces a required check, leaving the merge box waiting. Keep that workflow eligible for the relevant pull request and merge group events. Gate the expensive job inside the workflow and require a final job that explicitly checks the decision and test outcome.
The check is missing, even though nothing failed
A documentation pull request is ready to merge. The merge box says it is waiting for a required check, but the Actions tab has no corresponding run. If the workflow uses a path filter that excludes the changed files, GitHub may never start the workflow that would report that check. Re-running old jobs or waiting longer cannot create a result for the current candidate.
The useful distinction is between scheduling a workflow and scheduling work inside it. Keep the workflow that reports the required check eligible for every relevant merge candidate. Decide within that workflow whether the expensive work is necessary. A small final job should report the result of that decision and refuse to pass when it cannot establish the expected outcome.
First verify that path filtering actually explains the symptom. Check the exact required name, the expected check source, and the commit the merge box is evaluating. A green run from an older commit does not satisfy a requirement on the current one. If GitHub is showing test-merge checks, compare against that candidate rather than assuming the pull request head is the only SHA involved.
Reproduce the missing check with a docs-only change
Suppose the repository requires the app-tests check, and the only workflow producing it is the filtered example below. A change to docs/overview.md does not match app/**, so this trigger is not eligible. The same applies to a change only in ci/test.sh, even though that file controls the test command. An incomplete positive path list can omit precisely the changes you want to validate.
Do not confuse the result with a job whose if condition evaluates false inside a workflow that did start. GitHub treats skipped jobs differently from whole workflows that never run. A required job that depends on another job can also be skipped by dependency handling. This is why the final job must inspect dependency outcomes and why simply removing the filter from one conditional test job is not enough.
| Observation | Likely boundary | What to check next |
|---|---|---|
| No matching run for the current candidate | Trigger or event | Path and branch filters, skip directives, approvals and event type |
| Run exists; expected job is skipped | Job condition or dependency | Condition, classifier output and needs results |
| Matching job passed on an earlier SHA | Commit identity | Head or test-merge candidate shown by the merge box |
| PR check passed; queue is waiting | Merge group | Separate event and current merge-group candidate |
name: Filtered CI
on:
pull_request:
paths:
- 'app/**'
jobs:
app-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: bash ci/test.shAllow the workflow to run and narrow the optional work
The example below treats changes entirely inside docs/ as eligible to skip application tests. Every other changed path requires tests, including changes to the workflow, its test entry point, and unfamiliar files at the repository root. Use that exception only if your documentation cannot alter application behavior or build inputs. If it can, make the exception narrower or remove it.
The classifier compares the pull request’s base and head using a three-dot Git diff, which starts from their merge base. This avoids treating unrelated new base-branch files as if the pull request changed them. Rename detection is disabled for this decision, so moving a file out of or into docs/ exposes the non-docs side as a deletion or addition. A diff error fails classification rather than being interpreted as an empty change.
The example checks out full history to make the relevant commits available and treats every merge-group candidate as requiring tests. That is a deliberate conservative policy for combined candidates; it does not try to reuse a single pull request’s decision. In a large repository, you may optimize fetching later, but verify both endpoints and their merge base before trusting a narrower checkout.
Source: Git: diff endpoints, exit codes and rename detection ↗
Require the final policy check
Place the following in a dedicated workflow in a test repository or branch. Replace bash ci/test.sh with your real checked-in test entry point; make sure it fails when tests fail or cannot run. The example uses pull_request, read-only repository contents permission, and disables checkout credential persistence. Review the checkout version and pin an approved revision if your repository requires immutable action references.
The classifier must succeed and emit a known decision. The test job runs only for true. The final job explicitly requests evaluation even when dependencies fail or skip, then permits only two combinations: a required test job that succeeded, or an explicitly unnecessary test job that skipped. An empty or unknown decision cannot become a pass. Require the observed Required CI check from the intended source, rather than the optional test job.
The example gates app tests, not every security or compliance check in a repository. Keep independent requirements intact. A workflow can still be prevented from starting by an approval requirement, skip directive, event mismatch or repository policy. A final job cannot report for a run that never starts, and a canceled run should not be interpreted as approval.
name: Pull request CI
on:
pull_request:
merge_group:
types: [checks_requested]
permissions:
contents: read
jobs:
classify:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.scope.outputs.run_tests }}
steps:
- if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- id: scope
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
case "$GITHUB_EVENT_NAME" in
merge_group)
run_tests=true
;;
pull_request)
if git diff --quiet --no-renames --ignore-submodules=none "$BASE_SHA...$HEAD_SHA" -- . ':(exclude,top)docs/**'; then
run_tests=false
else
status=$?
if [[ "$status" -ne 1 ]]; then exit "$status"; fi
run_tests=true
fi
;;
*) exit 1 ;;
esac
printf 'run_tests=%s\n' "$run_tests" >> "$GITHUB_OUTPUT"
app-tests:
needs: classify
if: ${{ needs.classify.outputs.run_tests == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- run: bash ci/test.sh
required:
name: Required CI
needs: [classify, app-tests]
if: ${{ always() }}
runs-on: ubuntu-latest
env:
CLASSIFY_RESULT: ${{ needs.classify.result }}
RUN_TESTS: ${{ needs.classify.outputs.run_tests }}
TEST_RESULT: ${{ needs.app-tests.result }}
steps:
- name: Check required CI policy
shell: bash
run: |
set -euo pipefail
if [[ "$CLASSIFY_RESULT" == success ]]; then
case "$RUN_TESTS:$TEST_RESULT" in
true:success|false:skipped) exit 0 ;;
esac
fi
printf 'CI policy failed: classify=%s run_tests=%s tests=%s\n' \
"$CLASSIFY_RESULT" "$RUN_TESTS" "$TEST_RESULT" >&2
exit 1Know what path detection does and does not guarantee
The classifier answers whether the final pull request diff contains a path outside docs/. It does not interpret dependencies inside documents, or detect transient edits that were completely reverted before the final diff. It passes commit values through the environment and quotes them in shell. Keep paths and shell logic reviewed; do not add untrusted PR text directly to a run script.
GitHub’s trigger-level path filters have documented limits, including how many changed files are inspected. Here the detector reads the Git diff after the workflow starts instead of relying on a trigger’s file list. A failed fetch or absent merge base is a real error, not a safe skip. The local classifier tests included a diverged base, renames, a large set of docs changes, and an unavailable commit.
With a merge queue, the merge group is a different candidate. Even when the pull request had no application changes, a group may include other changes and must get its own required result. Keep both event paths in the test plan. Avoid solving a missing check by moving untrusted code execution to a privileged pull_request_target workflow.
Prove the gate rejects unexpected outcomes
Test the rules with one docs-only pull request, one change outside docs/, and one deliberate failure in the real test command. In the docs-only case the final job must pass after classification succeeds and tests skip. In the code-change case it must fail if tests fail or are skipped unexpectedly. If a queue is enabled, also check that the same required name is emitted for a merge group.
The YAML structure, classifier shell, and final policy shell were checked locally. The test command is repository-specific, and the example was not run on GitHub-hosted infrastructure. Check the actual Actions run, displayed check name, associated app, and protected-branch behavior in a disposable repository before changing a production rule.
| Classifier result | Decision | Test result | Final policy |
|---|---|---|---|
| success | false | skipped | Pass: intentional skip |
| success | true | success | Pass: required tests passed |
| success | true | failure, cancelled or skipped | Fail |
| success | false | success | Fail: decision and execution disagree |
| failure, cancelled or skipped | Any | Any | Fail if evaluated |
| success | Empty or unknown | Any | Fail |
Separate a missing run from a missing gate result
Start on the pull request’s checks view and open the run linked to the current candidate. If the run is absent, inspect the workflow event and eligibility before debugging shell. For example, a workflow triggered only by pushes to a branch may report a result for a different commit than the one GitHub is evaluating for the pull request. A filter on the pull request’s target branch must cover every branch that requires this check.
If the run exists but the gate failed, read the three values printed by the gate. A failed classifier points to the fetch, event or diff, while true with a failed test points to the test logs. A successful classifier with an empty output points to the output name or the step that writes it. A skipped test is acceptable only when the classifier succeeded and explicitly emitted false.
If the gate passed but merging is still blocked, compare the exact check name and source with the rule and look for other requirements. The gate cannot waive reviews or independent checks. Record the intended docs exception and the check name next to the workflow so a later rename or rule edit does not silently recreate the problem.
Change the protection rule after the new check is visible
Introduce the final check first, keep the old protection until the new one has been observed, and test both branches of the policy. Add the new requirement using the name and source GitHub actually shows. Only then retire the old requirement or its filtered workflow. Avoid duplicate job names across workflows when those jobs are intended to represent different policies.
If the merge box still waits, diagnose by layer: candidate SHA, eligible event, workflow run, classifier decision, test outcome, and final check. That ordering is faster than changing path patterns at random. The outcome to preserve is simple: a merge candidate gets a clear check result, and test work is skipped only when a reviewed policy says it is unnecessary.
- Find the exact required check and candidate SHA.
- Confirm the expected event produced a workflow run.
- Compare the classifier output and dependency results with the gate table.
- Verify the protection rule still names the correct check and source.
Your next steps
- A skipped workflow and a skipped job have different consequences for required checks.
- Treat unknown scope or missing required test results as failure.
- Verify the check name and source on the correct candidate SHA before changing branch protection.
Sources & official resources
Linked resources checked on 2026-11-07. Technical behavior and provider guidance can change; check the documentation for the version you use.
About this guide and its recommendations
Published by Prep With Proof with AI-assisted drafting. Study routines and examples are editorial suggestions, not official exam instructions or claims of a learner's personal results. Cited provider facts are linked; ownership of recommended Prep With Proof products is disclosed. No competitor endorsement or guaranteed certification outcome is implied.
Suggest a correction →