Skip to content

Commit bba5fc9

Browse files
kyleconroyclaude
andauthored
Skip CI/RTD builds when the change is irrelevant (#4381)
- Add paths-ignore for docs/** and .readthedocs.yaml to the go, buf, kotlin, python, and typescript workflows so doc-only PRs don't spin up the Go test matrix. - Add a Read the Docs post_checkout hook that exits 183 (the documented "cancel build successfully" code) for PR builds that don't touch docs/ or .readthedocs.yaml, mirroring the inverse on the RTD side. Note: if any of the skipped checks are currently listed as required in branch protection, doc-only PRs will block waiting for them. Flip those to non-required, or add a matching no-op workflow that runs under the ignored paths, as a follow-up. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cff03f4 commit bba5fc9

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

.github/workflows/buf.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: buf
2-
on: pull_request
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- 'docs/**'
6+
- '.readthedocs.yaml'
37
jobs:
48
build:
59
runs-on: ubuntu-latest

.github/workflows/ci-kotlin.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ on:
33
push:
44
branches:
55
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
- '.readthedocs.yaml'
69
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
- '.readthedocs.yaml'
713
jobs:
814
build:
915
if: false

.github/workflows/ci-python.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ on:
33
push:
44
branches:
55
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
- '.readthedocs.yaml'
69
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
- '.readthedocs.yaml'
713
jobs:
814
build:
915
if: false

.github/workflows/ci-typescript.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ on:
33
push:
44
branches:
55
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
- '.readthedocs.yaml'
69
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
- '.readthedocs.yaml'
713
jobs:
814
build:
915
if: false

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ on:
33
push:
44
branches:
55
- main
6+
paths-ignore:
7+
- 'docs/**'
8+
- '.readthedocs.yaml'
69
pull_request:
10+
paths-ignore:
11+
- 'docs/**'
12+
- '.readthedocs.yaml'
713
jobs:
814
build:
915
strategy:

.readthedocs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ build:
1010
os: ubuntu-22.04
1111
tools:
1212
python: "3.11"
13+
jobs:
14+
post_checkout:
15+
# Cancel PR builds that don't touch the docs.
16+
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
17+
- |
18+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/ .readthedocs.yaml; then
19+
exit 183
20+
fi
1321
1422
# Build documentation in the docs/ directory with Sphinx
1523
sphinx:

0 commit comments

Comments
 (0)