ci: stop using paths-ignore on required checks; short-circuit docs-only via composite action (#18219)

* ci: add detect-docs-only composite action

Centralizes docs-only detection so required workflows can always trigger
and short-circuit cleanly instead of using paths-ignore (which hangs
required status checks on docs-only PRs).

* ci(codestyle): drop paths-ignore; short-circuit on docs-only

Replaces paths-ignore (which caused required check to hang on docs-only
PRs) with step-level if: gating driven by detect-docs-only composite
action. Job name preserved for branch-protection compatibility.

* ci(tests): drop dorny/paths-filter; use detect-docs-only

Replaces the third-party paths-filter with the in-repo composite action
for a single source of truth. Also removes the residual empty
paths-ignore: key under on.pull_request to prevent regressions.

* ci(test_gpu): drop paths-ignore; unify on detect-docs-only

Removes external paths-ignore that conflicted with the internal aggregator
pattern (causing required check test-pr-gpu to hang on docs-only PRs).
Replaces the hand-written git diff block with the detect-docs-only
composite action. Renames output skip_gpu to docs_only for consistency
with tests.yml. Required check name test-pr-gpu preserved.

* ci: remove local test harness for detect-docs-only

The matcher was validated locally; the harness is not needed in CI.

* ci: retrigger CLA check after email verification
This commit is contained in:
lqliu7 authored and GitHub committed 2026-06-26 17:30:14 +08:00
1 parent 6d2110b743
commit 211989f046
4 files changed
+98 -95

No files matched your search

@@ -0,0 +1,55 @@
name: Detect Docs-Only Change
description: >
Output docs_only=true if every changed file in the current pull_request
matches docs/**, **/*.md, or .github/**. On push or workflow_dispatch,
always output docs_only=false.
outputs:
docs_only:
description: "true if change is docs-only, otherwise false"
value: ${{ steps.compute.outputs.docs_only }}
runs:
using: composite
steps:
- id: compute
shell: bash
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
echo "docs_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git fetch origin "${GITHUB_BASE_REF}" --depth=1 >/dev/null 2>&1 || true
CHANGED_FILES="$(git diff --name-only "origin/${GITHUB_BASE_REF}...HEAD")"
# >>> matcher-begin
shopt -s globstar extglob nullglob
is_docs_only() {
local files="$1"
if [ -z "$files" ]; then
echo "false"; return 0
fi
while IFS= read -r f; do
[ -z "$f" ] && continue
case "$f" in
docs/*) ;;
.github/*) ;;
*.md) ;;
*)
# also accept nested */**/*.md via case glob
case "$f" in
*/*.md) ;;
*) echo "false"; return 0 ;;
esac
;;
esac
done <<< "$files"
echo "true"
}
result="$(is_docs_only "${CHANGED_FILES}")"
if [ -n "${GITHUB_OUTPUT:-}" ] && [ "${GITHUB_OUTPUT}" != "/dev/null" ]; then
echo "docs_only=${result}" >> "$GITHUB_OUTPUT"
fi
echo "${result}"
# <<< matcher-end
+31 -34
View File
@@ -1,44 +1,41 @@
name: PaddleOCR Code Style Check
# NOTE: Job name `check-code-style` is the required status check context
# configured in branch protection. Do not rename without updating settings.
on:
pull_request:
paths-ignore:
- docs/**
- '**/*.md'
- .github/**
pull_request: {}
push:
branches: ['main', 'release/*']
paths-ignore:
- docs/**
- '**/*.md'
- .github/**
jobs:
check-code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache Python dependencies
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies for Python
run: |
python -m pip install --upgrade pip
pip install "clang-format==13.0.0"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: '--all-files'
- uses: actions/checkout@v6
with:
ref: ${{ github.ref }}
fetch-depth: 0
- id: detect
uses: ./.github/actions/detect-docs-only
- uses: actions/setup-python@v6
if: steps.detect.outputs.docs_only != 'true'
with:
python-version: '3.10'
- name: Cache Python dependencies
if: steps.detect.outputs.docs_only != 'true'
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies for Python
if: steps.detect.outputs.docs_only != 'true'
run: |
python -m pip install --upgrade pip
pip install "clang-format==13.0.0"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
if: steps.detect.outputs.docs_only != 'true'
with:
extra_args: '--all-files'
+8 -44
View File
@@ -3,16 +3,8 @@ name: PaddleOCR PR Tests GPU
on:
push:
branches: ["main"]
paths-ignore:
- docs/**
- '**/*.md'
- .github/**
pull_request:
branches: ["main"]
paths-ignore:
- docs/**
- '**/*.md'
- .github/**
workflow_dispatch:
env:
PR_ID: ${{ github.event.pull_request.number }}
@@ -30,46 +22,18 @@ jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
skip_gpu: ${{ steps.compute_skip.outputs.skip_gpu }}
docs_only: ${{ steps.detect.outputs.docs_only }}
steps:
- uses: actions/checkout@v6
- id: compute_skip
name: Compute skip_gpu (PR-only); push/workflow_dispatch always run GPU
shell: bash
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "skip_gpu=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git fetch origin "${{ github.base_ref }}" --depth=1
changed_files="$(git diff --name-only "origin/${{ github.base_ref }}"..HEAD)"
if [ -z "$changed_files" ]; then
echo "skip_gpu=false" >> "$GITHUB_OUTPUT"
exit 0
fi
skip_gpu=true
while IFS= read -r file; do
[ -z "$file" ] && continue
if [[ "$file" == ".github/workflows/test_gpu.yml" ]]; then
skip_gpu=false
break
fi
if [[ "$file" == docs/* ]] || [[ "$file" == paddleocr-js/* ]] || [[ "$file" == langchain-paddleocr/* ]] || [[ "$file" == skills/* ]] || [[ "$file" == mcp_server/* ]] || [[ "$file" == deploy/* ]] || [[ "$file" == *.md ]] || [[ "$file" == *.txt ]] || [[ "$file" == *.yml ]] || [[ "$file" == *.yaml ]]; then
continue
fi
skip_gpu=false
break
done <<< "$changed_files"
echo "skip_gpu=$skip_gpu" >> "$GITHUB_OUTPUT"
with:
fetch-depth: 0
- id: detect
uses: ./.github/actions/detect-docs-only
test-pr-gpu-impl:
runs-on: [self-hosted, GPU-2Card-OCR]
needs: detect-changes
if: needs.detect-changes.outputs.skip_gpu != 'true'
if: needs.detect-changes.outputs.docs_only != 'true'
steps:
- name: run test
env:
@@ -142,8 +106,8 @@ jobs:
echo "detect-changes did not succeed: ${{ needs.detect-changes.result }}"
exit 1
fi
if [ "${{ needs.detect-changes.outputs.skip_gpu }}" = "true" ]; then
echo "Skip flag set; treating GPU tests as not required for this change."
if [ "${{ needs.detect-changes.outputs.docs_only }}" = "true" ]; then
echo "Docs-only change; treating GPU tests as not required."
exit 0
fi
if [ "${{ needs.test-pr-gpu-impl.result }}" != "success" ]; then
+4 -17
View File
@@ -5,8 +5,6 @@ on:
branches: ["main", "release/*"]
pull_request:
branches: ["main", "release/*"]
paths-ignore:
permissions:
contents: read
@@ -15,24 +13,13 @@ jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.filter.outputs.docs_only }}
docs_only: ${{ steps.detect.outputs.docs_only }}
steps:
- uses: actions/checkout@v6
- id: filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
with:
predicate-quantifier: every
filters: |
docs_only:
- '**.md'
- '**.txt'
- '**.yml'
- '**.yaml'
- 'paddleocr-js/**'
- 'langchain-paddleocr/**'
- 'skills/**'
- 'mcp_server/**'
- 'deploy/**'
fetch-depth: 0
- id: detect
uses: ./.github/actions/detect-docs-only
test-pr-python:
runs-on: ubuntu-latest