-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (70 loc) · 2.91 KB
/
Copy pathci-docs.yml
File metadata and controls
80 lines (70 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: KeyPath CI (docs)
# Companion to ci.yml. ci.yml uses `paths-ignore` (docs/**, *.md, resources, …) so it
# does NOT run on docs-only PRs — which leaves the *required* `build-and-test` (and, per
# #652, `code-quality`) checks unreported, so the PR is permanently BLOCKED and can only
# be admin-merged (#650). This workflow triggers on exactly those ignored paths and
# reports the same check-run names as success, so docs-only PRs satisfy branch protection
# without an admin override. The `paths` list MUST mirror ci.yml's `paths-ignore`.
#
# Mixed PRs (docs + code) trigger this workflow at the event level, but the
# classifier job below keeps the required-context stubs from running unless
# every changed file is docs/resource-only. That avoids duplicate green
# `build-and-test` / `code-quality` checks on ordinary code PRs.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main, master]
paths:
- 'docs/**'
- '*.md'
- '.github/workflows/claude.yml'
- '.github/workflows/claude-code-review.yml'
- 'Sources/KeyPathAppKit/Resources/*.md'
- 'Sources/KeyPathAppKit/Resources/*.css'
- 'Sources/KeyPathAppKit/Resources/*.png'
concurrency:
group: ci-docs-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
classify-docs-only:
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.classify.outputs.docs_only }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Check whether all changed files are docs-only
id: classify
shell: bash
run: |
set -euo pipefail
base="${{ github.event.pull_request.base.sha }}"
docs_only=true
while IFS= read -r path; do
[ -n "$path" ] || continue
case "$path" in
docs/*|*.md|.github/workflows/claude.yml|.github/workflows/claude-code-review.yml|Sources/KeyPathAppKit/Resources/*.md|Sources/KeyPathAppKit/Resources/*.css|Sources/KeyPathAppKit/Resources/*.png)
;;
*)
docs_only=false
;;
esac
done < <(git diff --name-only "$base"...HEAD)
echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT"
echo "docs_only=$docs_only"
# Job names MUST match ci.yml's required check contexts exactly.
build-and-test:
needs: classify-docs-only
if: needs.classify-docs-only.outputs.docs_only == 'true'
runs-on: ubuntu-latest
steps:
- run: echo "Docs-only change — no Swift build/test applicable; reporting success (#650)."
code-quality:
needs: classify-docs-only
if: needs.classify-docs-only.outputs.docs_only == 'true'
runs-on: ubuntu-latest
steps:
- run: echo "Docs-only change — no Swift code-quality applicable; reporting success (#650)."