You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fc08057
Browse filesBrowse the repository at this point in the historyBrowse files
fork-follow: guard per run attempt, refuse the branch move while a new upstream workflow is unlisted
"Re-run failed jobs" and "Re-run job" keep the Guard job's result from an
earlier attempt without running it again. The guard now outputs the attempt it
passed in (set only after the guard script), and plan and advance run only
when that is this attempt: a job-level if, so a skipped job never reaches the
Environment. The report says to re-run all jobs. Before the branch move,
advance checks the Environment's rule again (fork-follow-guard.sh
--environment-only), because the release can take an hour or more.
The Environment ties the token to the branch main, not to fork-follow.yml, so
any workflow file on main may ask for it. The plan names the upstream workflow
files that are new on the target release (a rename counts as new). Advance
sweeps before the push, and refuses to move main while one of them is in the
candidate and GitHub does not list it, since it cannot be disabled first. The
reason says how a person moves main, or that a fork patch can delete the files.
The sweep names only the new files as unregistered (with a warning). Unlisted
files from earlier releases, most of which only run on events the fork never
sends, go to unregistered_old and into a collapsed note in the summary.
Tests: the plan's only job-level if is this attempt's guard (always(),
!cancelled() and failure() turn it red); advance needs this attempt's guard; a
pattern series branch with the matching rule is refused; new vs old unlisted
files; the refusal before the move; the report on a stale guard.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
[[ -z"${FINISHED:-}" ]] || row "**Upstream runs that finished before a sweep could stop them**""${FINISHED//,/, }"
100
114
[[ -z"${UNREGISTERED:-}" ]] \
101
-
|| row "**Upstream workflow files GitHub does not list yet, so not disabled** (the sweep after their first run disables them)""${UNREGISTERED//,/, }"
115
+
|| row "**Upstream workflow files new on this release that GitHub does not list yet, so not disabled** (the sweep after an event reaches them disables them; the branch move waits for that)""${UNREGISTERED//,/, }"
102
116
[[ -z"${DROPPED:-}" ]] || row "Patches dropped (empty on $BASE_TAG: upstream has the change)""${DROPPED//;/, }"
103
117
104
118
reasons=""
119
+
if [[ "$stale_guard"==true ]];then
120
+
reasons+="This is attempt $RUN_ATTEMPT of the run, but the guard passed in attempt $GUARD_ATTEMPT: \"Re-run failed jobs\" and \"Re-run job\" keep the guard's earlier result without checking again, so the jobs that get FORK_PUSH_TOKEN were skipped. Use \"Re-run all jobs\", or start a new run (\`gh workflow run fork-follow.yml --repo $REPOSITORY\`)."$'\n\n'
stage) what="Push the candidate on ${BASE_TAG:-?}; its release needs its own workflow files." ;;
117
134
*) if [[ "${GUARD_RESULT:-success}"!= success ]];then
118
135
what="None: the guard refused, so no job got FORK_PUSH_TOKEN."
136
+
elif [[ "$stale_guard"==true ]];then
137
+
what="None: the guard did not run in this attempt, so no job got FORK_PUSH_TOKEN."
119
138
else
120
139
what="The plan did not finish."
121
140
fi ;;
@@ -142,6 +161,14 @@ body="$(mktemp)"
142
161
echo"| What | State now |"
143
162
echo"|---|---|"
144
163
printf'%s\n'"${state[@]}"
164
+
if [[ -n"$UNREGISTERED_OLD" ]];then
165
+
echo
166
+
echo"<details><summary>Upstream workflow files from earlier releases that GitHub does not list (not a warning)</summary>"
167
+
echo
168
+
echo"Most of them run only on events this fork never sends (workflow_call, workflow_dispatch, workflow_run), so they stay unlisted. A sweep disables one once an event reaches it: ${UNREGISTERED_OLD//,/, }"
169
+
echo
170
+
echo"</details>"
171
+
fi
145
172
} >"$body"
146
173
147
174
# --- the issue, when the repository has Issues ---------------------------------------------------
check "workflows: an unlisted upstream file new on this release is named with a warning, not called disabled" \
487
+
eval'[[ "$(sed -n "s/^unregistered=//p" "$root/sweep.out")" == ".github/workflows/release.yml" && -z "$(sed -n "s/^unregistered_old=//p" "$root/sweep.out")" ]] && has "::warning::.*new on this release.*does not list yet" "$root/out"'
488
+
rm -f "$root/api/writes""$root/report.md"
489
+
check "workflows: before the move, a new unlisted upstream file refuses it, after disabling the listed ones" \
490
+
eval'! OWN_WORKFLOWS=.github/workflows/fork-follow.yml HEAD_SHA=abc NEW_WORKFLOWS=.github/workflows/release.yml REQUIRE_NEW_OFF=true sweep && has "main was not moved" "$root/report.md" && has "release.yml" "$root/report.md" && has "A person decides" "$root/report.md" && has "workflows/2/disable" "$root/api/writes"'
491
+
rm -f "$root/report.md"
492
+
check "workflows: before the move, a new upstream file GitHub lists (now disabled) and older unlisted ones do not refuse it" \
check "workflows: an empty own list disables nothing (refusing to guess)"eval'[[ ! -e "$root/api/writes" ]] && has "refusing to guess" "$root/report.md"'
FINISHED="13 (.github/workflows/relay-preview.yml: success after push)" UNREGISTERED=".github/workflows/release.yml"
524
559
check "report: names upstream runs that finished first and files GitHub does not list yet" \
525
560
eval'has "finished before a sweep could stop them" "$root/summary.md" && has "relay-preview.yml: success after push" "$root/summary.md" && has "does not list yet" "$root/summary.md" && has "release.yml" "$root/summary.md"'
check "workflow: the guard's attempt output is set only by a step after the guard script" \
610
+
eval'grep -qF "attempt: \${{ steps.passed.outputs.attempt }}" <<< "$guard_job" && awk "/fork-follow-guard.sh/ { g = NR } /id: passed/ { p = NR } /attempt=\\\$GITHUB_RUN_ATTEMPT/ { a = NR } END { exit !(g && p > g && a > p) }" <<< "$guard_job"'
611
+
advance_job="$(sed -n '/^ advance:$/,/^ [a-z_-]*:$/p'"$workflow"| sed '$d')"
612
+
check "workflow: before the move, advance checks the Environment again and sweeps, refusing new unlisted files" \
613
+
eval'awk "/fork-follow-guard.sh --environment-only/ { g = NR } /REQUIRE_NEW_OFF: \"true\"/ { r = NR } /NEW_WORKFLOWS: .*new_workflows/ && !n { n = NR } /fork-follow-push.sh advance/ { m = NR } END { exit !(g && r && n && m && g < r && r < m && n < m) }" <<< "$advance_job"'
614
+
check "workflow: the move step runs only when the checks before it passed (no if:)" \
615
+
eval'awk "/- name: Move the series branch/ { s = 1; next } s && /^ - / { exit } s && /^ if:/ { bad = 1 } END { exit bad }" <<< "$advance_job"'
547
616
check "workflow: action none deletes a leftover candidate branch" \
0 commit comments