dev/t-mmyx6d0xfp0x/protected-main-pr
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>
action/cascade-from
Composite Gitea Action that bumps a FROM <image>:<tag> line in a target
repo's Dockerfile, then commits and pushes. The target repo's CI fires on
that push, rebuilding against the new base.
Consumers: fritzlab/base (→ base-dev), fritzlab/base-dev
(→ runner, base-agent) and fritzlab/base-agent (→ agent).
Usage
- uses: actions/checkout@v4
- uses: https://code.fritzlab.net/action/image-build@v1
with:
image: code.fritzlab.net/fritzlab/base
- uses: https://code.fritzlab.net/action/image-push@v1
with:
image: code.fritzlab.net/fritzlab/base
token: ${{ secrets.CI_BOT_TOKEN }}
org: fritzlab
name: base
- uses: https://code.fritzlab.net/action/cascade-from@v1
with:
target-repo: fritzlab/runner
image: code.fritzlab.net/fritzlab/base
token: ${{ secrets.CI_BOT_TOKEN }}
Inputs
| Name | Required | Default | Description |
|---|---|---|---|
target-repo |
yes | — | Target repo to edit (e.g. fritzlab/runner). |
image |
yes | — | Image to look for in the FROM line. |
tag |
no | github.run_number |
New tag to write into FROM. |
file |
no | Dockerfile |
File inside target-repo to edit. |
token |
yes | — | CI_BOT_TOKEN with write to target-repo (push a branch, open a pull request). |
host |
no | code.fritzlab.net |
Gitea host without protocol. |
message |
no | bump <name> to #<tag> |
Commit message override. |
Behavior
- Shallow-clone target-repo to a temp dir.
sed -i "s|^FROM <image>:.*|FROM <image>:<tag>|" <file>.- Verify sed actually matched a line — fail if not (catches typos in image name).
- If no diff (target already on this tag): exit 0 silently.
- Otherwise commit + push to
mainwith rebase-on-conflict retry up to 3 times. - If branch protection refuses the push (
Not allowed to push to protected branch main), push the commit tocascade/<name>-<tag>and open a pull request againstmaininstead. A re-run reuses that branch and pull request. The bump then lands through the target's normal review.
Notes
- Only matches lines starting with
FROM <image>:(anchored to start). Multi-stage Dockerfiles with a non-anchoredFROM <image>:tag AS stagewill be missed — add the AS-aware pattern as a future enhancement if needed. - Pushing to target-repo triggers its CI, which produces a new image of its own. There is no end-to-end orchestration: the upstream repo's CI completes the moment cascade-from pushes, regardless of whether the downstream build succeeds.
Tests
bash tests/run drives cascade.sh against local bare repositories (a
pre-receive hook stands in for branch protection) and a stubbed Gitea API.
Languages
Shell
100%