@1aboveio/skills 1.0.46 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/.codex-plugin/resources.json +155 -154
- package/package.json +4 -4
- package/skills/app-dev/airflow/SKILL.md +1 -1
- package/skills/app-dev/android-development/SKILL.md +1 -1
- package/skills/app-dev/app-debug/SKILL.md +1 -1
- package/skills/app-dev/better-auth/SKILL.md +1 -1
- package/skills/app-dev/data-catalog/SKILL.md +1 -1
- package/skills/app-dev/data-catalog/scripts/persist-conventions-core.mjs +7 -3
- package/skills/app-dev/data-quality/SKILL.md +1 -1
- package/skills/app-dev/interaction-design/SKILL.md +1 -1
- package/skills/app-dev/ios-foundation/SKILL.md +1 -1
- package/skills/app-dev/maestro/SKILL.md +1 -1
- package/skills/app-dev/monorepo/SKILL.md +1 -1
- package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
- package/skills/app-dev/prisma-setup/SKILL.md +1 -1
- package/skills/app-dev/pyspark/SKILL.md +1 -1
- package/skills/app-dev/python-backend/SKILL.md +1 -1
- package/skills/app-dev/shadcn/SKILL.md +1 -1
- package/skills/app-dev/zod-v4/SKILL.md +1 -1
- package/skills/cicd/cloud-build/SKILL.md +1 -1
- package/skills/cicd/cloud-debug/SKILL.md +1 -1
- package/skills/cicd/cloud-deploy/SKILL.md +1 -1
- package/skills/cicd/docker/SKILL.md +1 -1
- package/skills/cicd/github-actions/SKILL.md +67 -46
- package/skills/cicd/github-actions/references/audit-and-cleanup.md +80 -5
- package/skills/cicd/github-actions/references/conditional-ci.md +155 -178
- package/skills/cicd/github-actions/references/pipeline.md +63 -26
- package/skills/cicd/github-actions/references/two-pass-reading.md +50 -3
- package/skills/cicd/github-flow/SKILL.md +45 -19
- package/skills/cicd/github-flow/references/candidate-admission.md +51 -0
- package/skills/cicd/github-flow/references/ci-conventions.md +11 -12
- package/skills/cicd/github-flow/scripts/flow-core.mjs +10 -5
- package/skills/cicd/github-flow/scripts/persist-conventions-core.mjs +7 -3
- package/skills/cicd/github-flow/scripts/persist-conventions.mjs +55 -1
- package/skills/cicd/google-cloud/SKILL.md +1 -1
- package/skills/cicd/mergify/SKILL.md +1 -1
- package/skills/cicd/mergify/references/stacks.md +9 -2
- package/skills/cicd/mergify/scripts/stack-push-core.mjs +4 -1
- package/skills/cicd/podman/SKILL.md +1 -1
- package/skills/content/article-review/SKILL.md +1 -1
- package/skills/content/article-to-image/SKILL.md +1 -1
- package/skills/content/flowchart-svg/SKILL.md +1 -1
- package/skills/content/image-gen/SKILL.md +1 -1
- package/skills/content/mermaid/SKILL.md +1 -1
- package/skills/content/wechat-article-writer/SKILL.md +1 -1
- package/skills/content/wechat-publisher/SKILL.md +1 -1
- package/skills/content/wechat-search/SKILL.md +1 -1
- package/skills/content/xai-search/SKILL.md +1 -1
- package/skills/core/distill-writing/SKILL.md +1 -1
- package/skills/core/doc-to-md/SKILL.md +1 -1
- package/skills/core/editorial-review/SKILL.md +1 -1
- package/skills/core/house-style/SKILL.md +1 -1
- package/skills/core/plain-language/SKILL.md +1 -1
- package/skills/core/polish-cn/SKILL.md +1 -1
- package/skills/core/reg-parser/SKILL.md +1 -1
- package/skills/core/terminology/SKILL.md +1 -1
- package/skills/core/write-doc/SKILL.md +1 -1
- package/skills/core/write-report/SKILL.md +1 -1
- package/skills/engineering/acceptance-design/SKILL.md +1 -1
- package/skills/engineering/better-review/SKILL.md +1 -1
- package/skills/engineering/e2e-test/SKILL.md +1 -1
- package/skills/engineering/engineering/SKILL.md +1 -1
- package/skills/engineering/engineering/scripts/persist-conventions-core.mjs +7 -3
- package/skills/engineering/engineering-runtime/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/coherence/workflow.json +14 -14
- package/skills/engineering/ensure-coverage/SKILL.md +1 -1
- package/skills/engineering/golden-path/SKILL.md +1 -1
- package/skills/engineering/harness-runtime/SKILL.md +1 -1
- package/skills/engineering/resolve-issues/SKILL.md +2 -2
- package/skills/engineering/resolve-issues/references/ci.md +3 -0
- package/skills/engineering/resolve-issues/references/implementation.md +7 -2
- package/skills/engineering/resolve-issues/references/review.md +7 -2
- package/skills/engineering/resolve-issues/scripts/next-actions.mjs +5 -4
- package/skills/engineering/resolve-issues/scripts/review-verdict.mjs +19 -7
- package/skills/engineering/resolve-release/SKILL.md +1 -1
- package/skills/engineering/rush-issues/SKILL.md +1 -1
- package/skills/engineering/rush-release/SKILL.md +1 -1
- package/skills/engineering/test-quality/SKILL.md +1 -1
- package/skills/engineering/test-quality/scripts/persist-conventions-core.mjs +7 -3
- package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
- package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
- package/skills/risk-compliance/contract-review/SKILL.md +1 -1
- package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
- package/skills/risk-compliance/fraud-detection/SKILL.md +1 -1
- package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/rfi-writing/SKILL.md +1 -1
- package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
- package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
|
@@ -1,134 +1,161 @@
|
|
|
1
1
|
# Conditional CI
|
|
2
2
|
|
|
3
|
-
> Read when: selecting checks by changed paths, affected dependencies, events, or the
|
|
4
|
-
> merge queue.
|
|
5
|
-
|
|
6
3
|
## Dependency-aware selection
|
|
7
4
|
|
|
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
|
-
2. Add a `changes` job that selects affected work. In monorepos use dependency-aware
|
|
33
|
-
selection above; for simple areas, use path filters with shared inputs included in
|
|
34
|
-
every affected area. Exclude docs or configuration only when no checked task consumes them.
|
|
35
|
-
3. Give each area job `needs: changes` and `if: needs.changes.outputs.<area> == 'true'`.
|
|
36
|
-
4. Run network-dependent canaries only on demand: `if: github.event_name == 'workflow_dispatch'`.
|
|
37
|
-
A recurring canary goes in its own scheduled workflow, never as a scheduled rerun of `gate`.
|
|
38
|
-
5. Run slow suites only in the queue: `if: startsWith(github.head_ref, 'mergify/merge-queue/')`.
|
|
39
|
-
6. Add one `gate` job: `if: always()`, `needs:` every job, allow a skip only when that job's
|
|
40
|
-
condition was false. Require only `gate`.
|
|
41
|
-
7. Before merging, open one PR per area and confirm only that area's jobs run and `gate` passes.
|
|
5
|
+
For a new design, first identify the exact base, tested commit and lane. Run a
|
|
6
|
+
lightweight repository command to determine the verification obligations and
|
|
7
|
+
their reasons. Pin these inputs for local replay. A source PR, an assembled
|
|
8
|
+
queue batch and a bisected batch can require different work. Recompute when an
|
|
9
|
+
input changes. Cache deterministic analysis by **all** its inputs.
|
|
10
|
+
|
|
11
|
+
Use existing workspace tooling (for example Nx or Turbo) to find affected tasks
|
|
12
|
+
and direct and transitive consumers. Include shared inputs, generated sources
|
|
13
|
+
and toolchain configuration. Consult both graphs when edges are removed, added
|
|
14
|
+
or renamed. Classify both sides of a move. Map the resulting tasks to the
|
|
15
|
+
actual checks and execution prerequisites, including integration and device
|
|
16
|
+
cases that the package graph does not describe. Discover tests inside selected
|
|
17
|
+
tasks; fail a task that unexpectedly discovers no tests.
|
|
18
|
+
|
|
19
|
+
| Decision | When to make it |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| Full | An explicit qualification policy or an identified global input requires every suite in the lane. A small project may declare full coverage for every candidate. |
|
|
22
|
+
| Subset | The known affected consumers and checks require the listed suites. |
|
|
23
|
+
| None | Every changed input is accounted for and the project explicitly exempts the remaining work. A docs-only exemption requires proving no checked task consumes those docs. |
|
|
24
|
+
| Blocked | Selection failed, a required revision or dependency is unknown, or the plan is incomplete or invalid. Fail admission and explain what to resolve. |
|
|
25
|
+
|
|
26
|
+
An existing repo can explicitly choose and document a conservative full-suite
|
|
27
|
+
fallback. Preserve its policy during routine audit or optimization. Never turn
|
|
28
|
+
an unresolved input into an unexplained full run or an empty plan.
|
|
42
29
|
|
|
43
30
|
## Template
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
One automatic entry admits source PRs and the actual queue tree. The example
|
|
33
|
+
tests the source **head** on an ordinary PR, the assembled **head** of a Mergify
|
|
34
|
+
queue PR, and the event's **head** for GitHub native merge groups. The base comes
|
|
35
|
+
from the same event. If the repository qualifies GitHub's PR test-merge commit,
|
|
36
|
+
use its pinned SHA consistently for planning, worker checkout and evidence.
|
|
37
|
+
Choose the queue trigger the project uses. Without a queue, qualify the required
|
|
38
|
+
pre-merge work on an up-to-date PR and handle any declared main lane separately.
|
|
39
|
+
|
|
40
|
+
The sample pnpm workspace declares its public command in the root `package.json`:
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
```json
|
|
43
|
+
{ "scripts": { "ci:admit": "node ci/admit.mjs" } }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The root manifest also pins pnpm through its existing `packageManager` field.
|
|
47
|
+
Call the same root script locally and in Stage 0. Keep the repo's existing
|
|
48
|
+
equivalent script name. On pnpm 11 use
|
|
49
|
+
`pnpm --config.verify-deps-before-run=false --silent run ci:admit <base> <candidate> <lane>`
|
|
50
|
+
to suppress install-on-run for this invocation and capture a JSON plan. Keep
|
|
51
|
+
the selector and its lifecycle hooks runnable before dependencies are installed.
|
|
52
|
+
The sample command takes `base candidate lane`, resolves
|
|
53
|
+
the exact comparison, and prints one JSON object with those three fields, a
|
|
54
|
+
`reason` and a canonical `suites` array. It exits nonzero on blocked admission.
|
|
55
|
+
The public command owns the suite registry and validates selection before it
|
|
56
|
+
exits successfully. The Actions adapter checks the identity and shape of the
|
|
57
|
+
transported plan. The project's two suites are `api` and `device`. A full policy returns both;
|
|
58
|
+
an affected policy returns the appropriate set for this lane. Replace these
|
|
59
|
+
names and the CLI with the repository's own commands. Use the same CLI for the
|
|
60
|
+
local preflight described in `github-flow`. Keep complex selection, registry
|
|
61
|
+
validation and evidence checks in the primary toolchain.
|
|
50
62
|
|
|
51
63
|
```yaml
|
|
52
64
|
name: CI
|
|
53
|
-
|
|
54
65
|
on:
|
|
55
66
|
pull_request:
|
|
56
|
-
|
|
67
|
+
merge_group:
|
|
68
|
+
workflow_dispatch:
|
|
57
69
|
|
|
58
70
|
permissions:
|
|
59
71
|
contents: read
|
|
60
72
|
|
|
61
73
|
concurrency:
|
|
62
|
-
group:
|
|
63
|
-
|
|
74
|
+
group: >-
|
|
75
|
+
${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
|
|
76
|
+
!startsWith(github.head_ref, 'mergify/merge-queue/') &&
|
|
77
|
+
format('pr-{0}', github.event.pull_request.number) || format('run-{0}', github.run_id) }}
|
|
78
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'mergify/merge-queue/') }}
|
|
79
|
+
|
|
80
|
+
env:
|
|
81
|
+
BASE: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha }}
|
|
82
|
+
CANDIDATE: ${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }}
|
|
83
|
+
LANE: >-
|
|
84
|
+
${{ (github.event_name == 'merge_group' ||
|
|
85
|
+
(github.event.pull_request.head.repo.full_name == github.repository &&
|
|
86
|
+
startsWith(github.head_ref, 'mergify/merge-queue/'))) && 'queue' || 'pr' }}
|
|
64
87
|
|
|
65
88
|
jobs:
|
|
66
|
-
|
|
67
|
-
if: github.event_name
|
|
89
|
+
admit:
|
|
90
|
+
if: github.event_name != 'workflow_dispatch'
|
|
68
91
|
runs-on: ubuntu-latest
|
|
69
92
|
timeout-minutes: 5
|
|
70
|
-
permissions:
|
|
71
|
-
contents: read
|
|
72
|
-
pull-requests: read
|
|
73
93
|
outputs:
|
|
74
|
-
|
|
75
|
-
frontend: ${{ steps.filter.outputs.frontend }}
|
|
94
|
+
suites: ${{ steps.plan.outputs.suites }}
|
|
76
95
|
steps:
|
|
77
96
|
- uses: actions/checkout@v4
|
|
78
|
-
- id: filter
|
|
79
|
-
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
|
|
80
97
|
with:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
ref: ${{ env.CANDIDATE }}
|
|
99
|
+
fetch-depth: 0
|
|
100
|
+
persist-credentials: false
|
|
101
|
+
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1, uses the root packageManager version
|
|
102
|
+
with:
|
|
103
|
+
run_install: false
|
|
104
|
+
- id: plan
|
|
105
|
+
shell: bash
|
|
106
|
+
run: |
|
|
107
|
+
set -euo pipefail
|
|
108
|
+
test -n "$BASE" && test "$(git rev-parse HEAD)" = "$CANDIDATE" || exit 1
|
|
109
|
+
pnpm --config.verify-deps-before-run=false --silent run ci:admit "$BASE" "$CANDIDATE" "$LANE" > "$RUNNER_TEMP/plan.json"
|
|
110
|
+
suites=$(jq -ces --arg b "$BASE" --arg c "$CANDIDATE" --arg l "$LANE" '
|
|
111
|
+
select(length == 1) | .[0]
|
|
112
|
+
| select(.base == $b and .candidate == $c and .lane == $l)
|
|
113
|
+
| select(.reason | strings | length > 0)
|
|
114
|
+
| .suites | select(type == "array" and all(.[]; type == "string" and length > 0))
|
|
115
|
+
| select(length == (unique | length))
|
|
116
|
+
' "$RUNNER_TEMP/plan.json")
|
|
117
|
+
jq -c . "$RUNNER_TEMP/plan.json"
|
|
118
|
+
echo "suites=$suites" >> "$GITHUB_OUTPUT"
|
|
119
|
+
|
|
120
|
+
checks:
|
|
121
|
+
needs: admit
|
|
122
|
+
if: >-
|
|
123
|
+
needs.admit.result == 'success' &&
|
|
124
|
+
needs.admit.outputs.suites != '' && needs.admit.outputs.suites != '[]'
|
|
108
125
|
strategy:
|
|
109
126
|
fail-fast: false
|
|
110
127
|
matrix:
|
|
111
|
-
|
|
128
|
+
suite: ${{ fromJSON(needs.admit.outputs.suites || '[]') }}
|
|
112
129
|
runs-on: ubuntu-latest
|
|
113
|
-
timeout-minutes:
|
|
130
|
+
timeout-minutes: 15
|
|
114
131
|
steps:
|
|
115
132
|
- uses: actions/checkout@v4
|
|
133
|
+
with:
|
|
134
|
+
ref: ${{ env.CANDIDATE }}
|
|
135
|
+
persist-credentials: false
|
|
116
136
|
- uses: ./.github/actions/setup
|
|
117
137
|
- env:
|
|
118
|
-
|
|
119
|
-
run: pnpm
|
|
138
|
+
SUITE: ${{ matrix.suite }}
|
|
139
|
+
run: pnpm run "test:$SUITE"
|
|
120
140
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
startsWith(github.head_ref, 'mergify/merge-queue/') &&
|
|
125
|
-
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true')
|
|
141
|
+
gate:
|
|
142
|
+
if: always() && github.event_name != 'workflow_dispatch'
|
|
143
|
+
needs: [admit, checks]
|
|
126
144
|
runs-on: ubuntu-latest
|
|
127
|
-
timeout-minutes:
|
|
145
|
+
timeout-minutes: 2
|
|
128
146
|
steps:
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
- env:
|
|
148
|
+
ADMISSION: ${{ needs.admit.result }}
|
|
149
|
+
SUITES: ${{ needs.admit.outputs.suites }}
|
|
150
|
+
CHECKS: ${{ needs.checks.result }}
|
|
151
|
+
shell: bash
|
|
152
|
+
run: |
|
|
153
|
+
set -euo pipefail
|
|
154
|
+
test "$ADMISSION" = success && test -n "$SUITES" || exit 1
|
|
155
|
+
jq -en --argjson suites "$SUITES" --arg checks "$CHECKS" '
|
|
156
|
+
($suites | type == "array") and
|
|
157
|
+
($checks == (if $suites == [] then "skipped" else "success" end))
|
|
158
|
+
'
|
|
132
159
|
|
|
133
160
|
canary:
|
|
134
161
|
if: github.event_name == 'workflow_dispatch'
|
|
@@ -139,6 +166,8 @@ jobs:
|
|
|
139
166
|
issues: write
|
|
140
167
|
steps:
|
|
141
168
|
- uses: actions/checkout@v4
|
|
169
|
+
with:
|
|
170
|
+
persist-credentials: false
|
|
142
171
|
- uses: ./.github/actions/setup
|
|
143
172
|
- env:
|
|
144
173
|
EXTERNAL_NETWORK: '1'
|
|
@@ -150,89 +179,37 @@ jobs:
|
|
|
150
179
|
gh issue create --repo "$GITHUB_REPOSITORY" \
|
|
151
180
|
--title "CI canary failed on $GITHUB_REF_NAME" \
|
|
152
181
|
--body "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
|
|
153
|
-
|
|
154
|
-
gate:
|
|
155
|
-
if: always() && github.event_name == 'pull_request'
|
|
156
|
-
needs: [changes, backend, frontend, e2e-full]
|
|
157
|
-
runs-on: ubuntu-latest
|
|
158
|
-
timeout-minutes: 2
|
|
159
|
-
steps:
|
|
160
|
-
- env:
|
|
161
|
-
CHANGES: ${{ needs.changes.result }}
|
|
162
|
-
BACKEND: ${{ needs.changes.outputs.backend }}
|
|
163
|
-
FRONTEND: ${{ needs.changes.outputs.frontend }}
|
|
164
|
-
IN_QUEUE: ${{ startsWith(github.head_ref, 'mergify/merge-queue/') }}
|
|
165
|
-
BACKEND_RESULT: ${{ needs.backend.result }}
|
|
166
|
-
FRONTEND_RESULT: ${{ needs.frontend.result }}
|
|
167
|
-
E2E_FULL_RESULT: ${{ needs.e2e-full.result }}
|
|
168
|
-
run: |
|
|
169
|
-
set -uo pipefail
|
|
170
|
-
fail=0
|
|
171
|
-
# check <job> <result> <expected to run: true|false>
|
|
172
|
-
check() {
|
|
173
|
-
case "$2" in
|
|
174
|
-
success) echo "ok $1" ;;
|
|
175
|
-
skipped) if [ "$3" != true ]; then echo "skip $1"
|
|
176
|
-
else echo "::error::$1 skipped but its paths changed"; fail=1; fi ;;
|
|
177
|
-
*) echo "::error::$1: $2"; fail=1 ;;
|
|
178
|
-
esac
|
|
179
|
-
}
|
|
180
|
-
code=false
|
|
181
|
-
if [ "$BACKEND" = true ] || [ "$FRONTEND" = true ]; then code=true; fi
|
|
182
|
-
full=false
|
|
183
|
-
if [ "$IN_QUEUE" = true ] && [ "$code" = true ]; then full=true; fi
|
|
184
|
-
[ "$CHANGES" = success ] || { echo "::error::changes: $CHANGES"; exit 1; }
|
|
185
|
-
check backend "$BACKEND_RESULT" "$BACKEND"
|
|
186
|
-
check frontend "$FRONTEND_RESULT" "$FRONTEND"
|
|
187
|
-
check e2e-full "$E2E_FULL_RESULT" "$full"
|
|
188
|
-
exit "$fail"
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Shared setup, `.github/actions/setup/action.yml`:
|
|
192
|
-
|
|
193
|
-
```yaml
|
|
194
|
-
name: setup
|
|
195
|
-
description: Node, pnpm, and dependencies
|
|
196
|
-
runs:
|
|
197
|
-
using: composite
|
|
198
|
-
steps:
|
|
199
|
-
- uses: actions/setup-node@v4
|
|
200
|
-
with:
|
|
201
|
-
node-version: '22'
|
|
202
|
-
- shell: bash
|
|
203
|
-
run: corepack enable
|
|
204
|
-
- shell: bash
|
|
205
|
-
run: pnpm install --frozen-lockfile
|
|
206
182
|
```
|
|
207
183
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
184
|
+
Here `setup` installs the full workspace only after admission (or in the
|
|
185
|
+
independent manual canary). Apply repo-specific fork and runner policies before
|
|
186
|
+
allocating a self-hosted job. If the checks use a local reusable workflow,
|
|
187
|
+
place the same successful-admission dependency and selection on the caller.
|
|
188
|
+
The called workflow consumes the admitted inputs. A required suite must fail
|
|
189
|
+
when selected cases are missing, skipped, failed or from another candidate or
|
|
190
|
+
build. For sharded checks, verify the promised coverage across all shards.
|
|
191
|
+
|
|
192
|
+
The manual dispatch above runs the standalone canary. Keep configured canary
|
|
193
|
+
failure alerts and independent schedules, post-deploy and release triggers.
|
|
194
|
+
If a manual input instead requests candidate validation, resolve its pinned
|
|
195
|
+
base and candidate and send that request through admission. Preserve meaningful
|
|
196
|
+
named checks, including distinct source/queue checks, during a cutover.
|
|
197
|
+
|
|
198
|
+
## Verify selection and failure propagation
|
|
199
|
+
|
|
200
|
+
- Compare the same base, candidate, lane, selector and policy locally and in
|
|
201
|
+
the Actions adapter. Inspect the emitted plan. Add a second PR touching
|
|
202
|
+
another consumer to the queue and inspect the new batch plan.
|
|
203
|
+
- Exercise a shared/global input, a subset, an explicit exemption, mixed
|
|
204
|
+
docs/runtime edits and a genuinely unknown input. Delete or rename a shared
|
|
205
|
+
input and change a graph edge; check consumers from both revisions.
|
|
206
|
+
- Inject failed, skipped and cancelled admission and missing, malformed or
|
|
207
|
+
foreign candidate outputs. Verify **both** the gate verdict and zero
|
|
208
|
+
expensive starts across **every** matching workflow, including path-filtered
|
|
209
|
+
workers and transitive reusable calls. Prove selected worker failure or
|
|
210
|
+
unexpected skip fails the gate, and an explicit empty plan passes.
|
|
211
|
+
- Inspect the parsed triggers and job DAG for reachability, then compare with
|
|
212
|
+
a replay or actual job records. Document which observations came from
|
|
213
|
+
static analysis. A passed main-workflow gate cannot see a separately
|
|
214
|
+
triggered worker. Re-run the check on the corrected DAG and cover manual
|
|
215
|
+
or scheduled exceptions independently.
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
## Lanes
|
|
7
7
|
|
|
8
8
|
```
|
|
9
|
-
PR
|
|
9
|
+
Source PR ───────► admit pinned candidate → selected checks → gate
|
|
10
10
|
│
|
|
11
11
|
[optional merge queue: Mergify, GitHub merge_group, or none]
|
|
12
12
|
▼
|
|
13
|
-
Queue candidate ──►
|
|
13
|
+
Queue candidate ──► admit assembled tree → selected combined-tree checks → gate
|
|
14
14
|
▼
|
|
15
15
|
merge to main ────► Cloud Build: build → push by digest → migrate (if changed) → deploy dev
|
|
16
16
|
▼
|
|
@@ -21,8 +21,9 @@ rc tag ───────────► Cloud Build: prod candidate at 0% tr
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
- **PR lane:** prove the change.
|
|
24
|
-
- **Queue lane:** prove the merged result
|
|
25
|
-
|
|
24
|
+
- **Queue lane:** prove the merged result. Put expensive pre-merge suites here when this
|
|
25
|
+
candidate and environment can qualify them. Without a queue, run these on the PR
|
|
26
|
+
and require an up-to-date branch. Apply the
|
|
26
27
|
[job and full-run timing targets](audit-and-cleanup.md#timing-targets).
|
|
27
28
|
- **No main test lane with a queue:** the queue already tested the tree that lands on `main`;
|
|
28
29
|
a merge to `main` triggers deploy, not a CI rerun. Without a queue, `push: main` tests it.
|
|
@@ -30,6 +31,33 @@ rc tag ───────────► Cloud Build: prod candidate at 0% tr
|
|
|
30
31
|
→ [post-deploy-and-publishing.md](post-deploy-and-publishing.md)
|
|
31
32
|
- **Scheduled lanes:** alert on failure (issue or chat ping).
|
|
32
33
|
|
|
34
|
+
## Admission before execution
|
|
35
|
+
|
|
36
|
+
1. Identify the lane and pin its base and candidate. Check out the same candidate
|
|
37
|
+
used by the selector. A repo may validate a PR head or GitHub's test-merge
|
|
38
|
+
commit. A queue batch or bisection always uses its actual assembled candidate.
|
|
39
|
+
2. In one lightweight `admit` job, perform only the checkout and bootstrap needed
|
|
40
|
+
for selection. Run the repo-native selector and validate its plan **before**
|
|
41
|
+
large installs, builds, database services, containers, emulators or devices.
|
|
42
|
+
A plan identifies its inputs, the selected obligations and the reason for full,
|
|
43
|
+
subset or explicit empty scope. A small repo may declare full coverage on every
|
|
44
|
+
candidate. See [dependency-aware selection](conditional-ci.md#dependency-aware-selection).
|
|
45
|
+
3. Make each expensive job or reusable-workflow call depend on successful admission
|
|
46
|
+
and explicit selection. Independent cheap checks can run alongside admission.
|
|
47
|
+
In strict designs, missing history, unknown dependencies, malformed output,
|
|
48
|
+
cancellation or unexpected skip cannot start an expensive job. Preserve an
|
|
49
|
+
existing conservative full-run policy only where the repo explicitly chose it.
|
|
50
|
+
4. Workers consume the admitted plan. Required checks verify all selected results
|
|
51
|
+
against this candidate and its artifacts, accepting skips only for declared
|
|
52
|
+
inapplicability. Cache deterministic analysis by all relevant inputs. Obtain
|
|
53
|
+
fresh evidence for environment-sensitive work such as a device run.
|
|
54
|
+
5. Expose selection and plan validation as one stable repository command. In a
|
|
55
|
+
pnpm workspace declare a script in the root `package.json`, conventionally
|
|
56
|
+
`pnpm run ci:admit <base> <candidate> <lane>`. Keep an existing equivalent
|
|
57
|
+
script name. CI Stage 0 and local pre-push call that same script from the
|
|
58
|
+
workspace root. It returns the validated plan or exits nonzero. Other stacks
|
|
59
|
+
use their native command. `github-flow` owns when to run it before publication.
|
|
60
|
+
|
|
33
61
|
## Acceptance execution
|
|
34
62
|
|
|
35
63
|
Execute the tests that prove the issue's Acceptance Criteria in the lane that can
|
|
@@ -63,33 +91,42 @@ agents reconstruct a campaign by hand.
|
|
|
63
91
|
|---|---|---|
|
|
64
92
|
| **None** | Low PR volume, one author | Require `gate` + "require branch up to date". |
|
|
65
93
|
| **Mergify** (most repos) | Batching, scopes, priorities | Candidates are draft PRs on `mergify/merge-queue/*` via `pull_request`. Let them through: `if: ${{ !github.event.pull_request.draft \|\| startsWith(github.head_ref, 'mergify/merge-queue/') }}`. Config: `mergify` skill. |
|
|
66
|
-
| **GitHub native** | No third-party app |
|
|
94
|
+
| **GitHub native** | No third-party app | Include `on: merge_group:` on the CI entry workflow. |
|
|
67
95
|
|
|
68
|
-
|
|
69
|
-
|
|
96
|
+
Resolve the lane in admission and pass the queue plan to downstream jobs. A new
|
|
97
|
+
member, rebase or bisection changes the selection inputs.
|
|
70
98
|
|
|
71
99
|
## The one required check
|
|
72
100
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
For a new repo, use a stable aggregating check named `gate`. An existing repo
|
|
102
|
+
may expose multiple named checks for distinct obligations. Preserve their names
|
|
103
|
+
and meaning when consolidating triggers. Change branch protection and queue
|
|
104
|
+
configuration together only as part of an authorized cutover.
|
|
105
|
+
|
|
106
|
+
1. Accept every applicable candidate in the entry workflow. Path filtering belongs
|
|
107
|
+
in admission. Keep explicit draft, fork and manual exemptions visible.
|
|
108
|
+
2. Run the final gate with `if: always()` for its applicable lane. Give it direct
|
|
109
|
+
`needs` on admission and the jobs whose results it must evaluate.
|
|
110
|
+
3. Fail the gate if admission failed, is absent, or emitted an invalid plan. Fail
|
|
111
|
+
on missing, failed or unexpectedly skipped selected work. When a matrix result
|
|
112
|
+
alone cannot establish that every planned check ran, collect per-check results.
|
|
113
|
+
4. Put matrix and sharded work behind the stable required checks. See the
|
|
114
|
+
[complete template](conditional-ci.md#template).
|
|
83
115
|
|
|
84
116
|
## Workflow layout
|
|
85
117
|
|
|
86
|
-
-
|
|
87
|
-
`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
-
|
|
118
|
+
- For new designs put automatic PR and queue validation in `.github/workflows/ci.yaml`.
|
|
119
|
+
Keep an established single `ci.yml` in place. Split complexity into jobs, local
|
|
120
|
+
reusable workflows with `workflow_call`, and composite actions. Keep distinct
|
|
121
|
+
post-deploy, scheduled and publishing lifecycles on their own triggers.
|
|
122
|
+
- YAML declares events, dependencies, resource allocation, permissions, artifact
|
|
123
|
+
transport and status. Keep complex planning and verification in testable,
|
|
124
|
+
workspace-owned code. In a Node monorepo use its Node/TypeScript toolchain,
|
|
125
|
+
package manager, runner, and existing Nx or Turborepo graph. A polyglot product
|
|
126
|
+
still runs its native tests and uses its infrastructure's specialized tools.
|
|
127
|
+
- Share across repos with a reusable workflow called by a pinned ref, with named
|
|
128
|
+
secrets. Add `workflow_dispatch` for independent manual work or a deliberate
|
|
129
|
+
replay with explicit inputs. Preserve its [security guards](security.md).
|
|
93
130
|
|
|
94
131
|
## A reused workspace
|
|
95
132
|
|
|
@@ -134,8 +171,8 @@ self-hosted specifics are an example of this rule, not a requirement of it.
|
|
|
134
171
|
- [ ] Every job has `timeout-minutes`
|
|
135
172
|
- [ ] `concurrency` set; cancels only on PRs
|
|
136
173
|
- [ ] No `paths:` on a workflow that reports `gate`
|
|
137
|
-
- [ ]
|
|
138
|
-
- [ ]
|
|
174
|
+
- [ ] Stable required checks account for every obligation in the admitted plan
|
|
175
|
+
- [ ] An invalid plan fails the applicable gate and starts zero expensive jobs, including reusable calls
|
|
139
176
|
- [ ] Full jobs and runs meet the [timing targets](audit-and-cleanup.md#timing-targets)
|
|
140
177
|
- [ ] Queue trigger handled (Mergify draft prefix or `merge_group`), if the repo uses a queue
|
|
141
178
|
- [ ] Self-hosted: fork guard, the labels your runner fleet actually carries,
|
|
@@ -6,7 +6,54 @@ Node package available (`node -e 'require("yaml")'` checks it). Use the reposito
|
|
|
6
6
|
existing parser dependency; if absent, arrange it outside an audit-only target checkout.
|
|
7
7
|
Do not parse workflow YAML with line-based regexes or execute workflow expressions.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Inventory every entry
|
|
10
|
+
|
|
11
|
+
From the repository root, set `SHA` to the commit defining the workflows under
|
|
12
|
+
review. For a checkout-only audit use `SHA=$(git rev-parse HEAD)`. The command
|
|
13
|
+
below reads the tracked versions, even if the working tree has local edits.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
node - "$SHA" <<'NODE'
|
|
17
|
+
const { execFileSync } = require('node:child_process');
|
|
18
|
+
const YAML = require('yaml');
|
|
19
|
+
const sha = process.argv[2];
|
|
20
|
+
const git = (...args) => execFileSync('git', args, { encoding: 'utf8' });
|
|
21
|
+
const dir = '.github/workflows';
|
|
22
|
+
const files = git('ls-tree', '-z', '--name-only', sha + ':' + dir).split('\0');
|
|
23
|
+
for (const name of files.filter(name => /\.ya?ml$/.test(name))) {
|
|
24
|
+
const file = dir + '/' + name;
|
|
25
|
+
const workflow = YAML.parse(git('show', sha + ':' + file), { merge: true });
|
|
26
|
+
if (!workflow?.on || !workflow.jobs) throw new Error('Invalid workflow: ' + file);
|
|
27
|
+
const events = workflow.on;
|
|
28
|
+
const triggers = typeof events === 'string' ? [events]
|
|
29
|
+
: Array.isArray(events) ? events : Object.keys(events);
|
|
30
|
+
for (const event of triggers) {
|
|
31
|
+
const config = events[event] ?? {};
|
|
32
|
+
const filters = Object.fromEntries(Object.entries(config).filter(([key]) =>
|
|
33
|
+
['types', 'branches', 'branches-ignore', 'paths', 'paths-ignore',
|
|
34
|
+
'tags', 'tags-ignore', 'workflows'].includes(key)));
|
|
35
|
+
console.log(JSON.stringify({file, event, filters}));
|
|
36
|
+
}
|
|
37
|
+
for (const [id, job] of Object.entries(workflow.jobs)) {
|
|
38
|
+
console.log(JSON.stringify({file, id, needs: job.needs ?? [], if: job.if ?? null,
|
|
39
|
+
uses: job.uses, runner: job['runs-on']}));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
NODE
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For a remote-only audit, enumerate files under `.github/workflows` at that SHA
|
|
46
|
+
via `gh api "repos/$REPO/contents/.github/workflows?ref=$SHA"`, then read each
|
|
47
|
+
YAML file using the raw-content request below. Retain filename, event filters,
|
|
48
|
+
job IDs, caller `uses`, conditions and dependencies. A `workflow_call` definition
|
|
49
|
+
is reached from its caller, but the same file may also have an automatic PR
|
|
50
|
+
trigger. Follow both paths. For `workflow_run` follow the named upstream workflows
|
|
51
|
+
and confirm which candidate the downstream checks out. Interpret the graph with
|
|
52
|
+
the [audit procedure](audit-and-cleanup.md#inventory-the-candidates-workflows);
|
|
53
|
+
this inventory lists configuration and does not predict dynamic expressions.
|
|
54
|
+
|
|
55
|
+
Set `SKILL_DIR` to the installed github-actions skill directory. Select a workflow
|
|
56
|
+
and relevant run from this inventory for a timing or failure investigation:
|
|
10
57
|
|
|
11
58
|
```bash
|
|
12
59
|
set -o pipefail
|
|
@@ -38,7 +85,7 @@ For saved inputs, replace `--repo "$REPO"` with `--from /path/to/runs.json`. Nul
|
|
|
38
85
|
stay unknown; zero stays zero. Created-to-start is an observed scheduling interval, not
|
|
39
86
|
proof of runner contention. Longest execution alone does not establish the critical path.
|
|
40
87
|
|
|
41
|
-
|
|
88
|
+
For remote-only inspection of one pinned workflow, use a YAML parser:
|
|
42
89
|
|
|
43
90
|
```bash
|
|
44
91
|
gh api "repos/$REPO/contents/$WORKFLOW?ref=$SHA" \
|
|
@@ -91,4 +138,4 @@ Stop when a bounded optimization is justified, or name the single missing check:
|
|
|
91
138
|
> or the concurrency lock were occupied. No workflow patch is justified yet.
|
|
92
139
|
|
|
93
140
|
The same distinction applies to caching: visible install cost is an opportunity, not
|
|
94
|
-
predicted savings; restore/install/save cost determines whether the candidate pays off.
|
|
141
|
+
predicted savings; restore/install/save cost determines whether the candidate pays off.
|