[t-mmyx6d0xfp0x] fix: open a pull request when main is protected
test / test (pull_request) Successful in 4s

Every cascade from base and base-dev has failed since August: runner,
base-dev and base-agent protect main against all pushes, so the direct
push is refused three times and the release job fails, and a refused
first target also skips the next cascade step. Push the bump to
cascade/<name>-<tag> and open a pull request instead, so it lands
through the target's review. Targets that still allow ci-bot to push
(fritzlab/agent) keep the direct push.

The script moves out of action.yaml into cascade.sh so tests/run can
drive it against local bare repositories and a stubbed API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Donavan FritzandClaude Opus 5.5 committed 2026-11-10 11:33:13 -06:00
1 parent 43875de6b4
commit d3dce56c31
6 files changed
+238 -56

No files matched your search

+2 -52
View File
@@ -32,7 +32,7 @@ inputs:
runs:
using: composite
steps:
- name: Clone, edit, push
- name: Clone, edit, push (or open a pull request)
shell: bash
env:
TARGET_REPO: ${{ inputs.target-repo }}
@@ -43,54 +43,4 @@ runs:
HOST: ${{ inputs.host }}
MESSAGE: ${{ inputs.message }}
RUN_NUMBER: ${{ github.run_number }}
run: |
set -euo pipefail
TAG="${TAG_INPUT:-$RUN_NUMBER}"
NAME="$(basename "$IMAGE")"
MSG="${MESSAGE:-bump ${NAME} to #${TAG}}"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
git clone --depth 1 "https://ci-bot:${TOKEN}@${HOST}/${TARGET_REPO}.git" "$WORK"
cd "$WORK"
git config user.name ci-bot
git config user.email ci-bot@fritzlab.net
if [ ! -f "$FILE" ]; then
echo "FATAL: ${FILE} not found in ${TARGET_REPO}"
exit 1
fi
# Escape forward slashes for sed pattern
ESC_IMAGE="${IMAGE//\//\\/}"
sed -i "s|^FROM ${IMAGE}:.*|FROM ${IMAGE}:${TAG}|" "$FILE"
if ! grep -q "^FROM ${IMAGE}:${TAG}\b" "$FILE"; then
echo "FATAL: sed did not match a FROM line for ${IMAGE} in ${FILE}"
grep "^FROM" "$FILE" || true
exit 1
fi
if git diff --quiet; then
echo "${TARGET_REPO} already on ${NAME}:${TAG}, skipping"
exit 0
fi
git add "$FILE"
git commit -m "$MSG"
ATTEMPTS=0
until git push origin main; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -ge 3 ]; then
echo "FATAL: push to ${TARGET_REPO} failed after ${ATTEMPTS} attempts"
exit 1
fi
echo "push rejected, attempt ${ATTEMPTS}; rebasing and retrying"
git pull --rebase origin main
sleep $((ATTEMPTS * 2))
done
echo "cascaded ${NAME}:${TAG} → ${TARGET_REPO}"
run: bash "${{ github.action_path }}/cascade.sh"