forked from heavy-duty/rig
test: terminate the ci.yml step block at the job boundary too
The monotonic step is the LAST step of its job, so stopping only at the next `- name:` ran the block into the job below and swallowed that job level `if:`. Unanchored `grep -q "if:"` then fired on it — the same bug the scoping was meant to fix, moved from "any step in the file" to "this step plus the head of the next job". Terminates on a new step OR a new job now, and the key is anchored so an `if:` inside a `run:` line is not mistaken for a step condition. Found by claude-bot-andresmgsl on heavy-duty/box#144; this port carried the identical awk. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c199e8fd04
commit
1db7779b03
1 changed files with 8 additions and 2 deletions
|
|
@ -441,12 +441,18 @@ check "ci.yml: ...against the PR's base branch" 0 "" \
|
||||||
# an extractor that matched nothing would turn the negative into a tautology
|
# an extractor that matched nothing would turn the negative into a tautology
|
||||||
# that passes forever, including after someone renames the step and re-adds
|
# that passes forever, including after someone renames the step and re-adds
|
||||||
# the gate.
|
# the gate.
|
||||||
|
# Terminates on a new STEP or a new JOB. The job boundary is not optional: the
|
||||||
|
# monotonic step is the LAST step of its job, so stopping only at the next
|
||||||
|
# `- name:` runs the block into the job below and swallows that job's
|
||||||
|
# level `if:` — the same bug this scoping fixed, moved from "any step in the
|
||||||
|
# file" to "this step plus the head of the next job" (found on box#144).
|
||||||
mono_step_block() {
|
mono_step_block() {
|
||||||
awk '/^ - name: no shipped changelog heading/ {f=1; print; next}
|
awk '/^ - name: no shipped changelog heading/ {f=1; print; next}
|
||||||
f && /^ - name: / {exit}
|
f && (/^ - / || /^ [^ ]/) {exit}
|
||||||
f {print}' "$CIY"
|
f {print}' "$CIY"
|
||||||
}
|
}
|
||||||
mono_step_gated() { mono_step_block | grep -q 'if:'; }
|
# Anchored: an `if:` inside a `run:` line is not a step condition.
|
||||||
|
mono_step_gated() { mono_step_block | grep -q '^ if:'; }
|
||||||
check "ci.yml: the monotonic step itself is NOT pull_request-gated (#98)" 1 "" \
|
check "ci.yml: the monotonic step itself is NOT pull_request-gated (#98)" 1 "" \
|
||||||
mono_step_gated
|
mono_step_gated
|
||||||
check "ci.yml: ...and the block was actually found (guards the awk above)" 0 \
|
check "ci.yml: ...and the block was actually found (guards the awk above)" 0 \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue