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
ci(stlc): gate the fork heal on staging CI passing on the merge
A clean text merge can still fail to build when the two sides combine
(a rename on one side, a new call to the old name on the other), and the
heal pushed that merge to production main before any CI ran on it.
The heal now force-pushes the merge commit to a stlc-fork-heal branch on
staging, which triggers the existing CI workflow, waits for that CI run
on the exact SHA (30 min cap), and pushes to both mains only on success.
A failure, cancellation, or timeout pushes nothing and fails with the
CI link and the commits on each side; the temporary branch is deleted
either way. Promote gains actions: read and passes github.token as
GH_TOKEN for the run lookup.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
echo"### Staging and production main have forked; heal blocked by CI"
59
+
echo
60
+
echo"They merge cleanly as text, but $1, so nothing was pushed to main. Fix the combination on either trunk (or push a fixed merge by hand); the next back-sync poll retries the heal."
61
+
echo
62
+
echo"CI run: ${CI_URL:-none found}"
63
+
echo
64
+
echo"**Only on staging:**"
65
+
echo'```'
66
+
echo"$STAGING_ONLY"
67
+
echo'```'
68
+
echo"**Only on production:**"
69
+
echo'```'
70
+
echo"$PRODUCTION_ONLY"
71
+
echo'```'
72
+
} >>"${GITHUB_STEP_SUMMARY:-/dev/stdout}"
73
+
echo"::error title=Fork heal blocked::$1 on clean merge commit ${MERGE}; nothing was pushed to main. CI run: ${CI_URL:-none found}"
74
+
exit 1
75
+
}
76
+
77
+
deadline=$((SECONDS + CI_TIMEOUT))
78
+
STATUS="" CONCLUSION="" CI_URL=""
79
+
while:;do
80
+
# A failed lookup reads as "not finished yet" and is retried until the deadline.
81
+
read -r STATUS CONCLUSION CI_URL <<(
82
+
gh api "repos/${GITHUB_REPOSITORY}/actions/runs?head_sha=${MERGE}&event=push" \
echo"The combination was not tested before it reached production; staging CI runs on the push."
113
+
echo"Staging CI passed on this exact commit before it was pushed: ${CI_URL}"
64
114
} >>"${GITHUB_STEP_SUMMARY:-/dev/stdout}"
65
115
echo"::warning title=Trunk fork healed::pushed clean merge commit ${SHORT} to staging and production main. See the job summary for the commits it joined."
0 commit comments