6969 git fetch upstream --no-tags
7070
7171 - name : Run rebase (single branch)
72+ id : rebase-single
7273 if : env.BRANCH != 'all'
7374 shell : bash
7475 run : |
@@ -89,14 +90,12 @@ jobs:
8990 GH_TOKEN : ${{ secrets.COPILOT_GITHUB_TOKEN }}
9091
9192 - name : Run rebase (all branches)
93+ id : rebase-all
9294 if : env.BRANCH == 'all'
9395 shell : bash
9496 run : |
9597 for BRANCH in seen next main maint; do
96- echo ""
97- echo "========================================"
98- echo "Processing shears/$BRANCH"
99- echo "========================================"
98+ echo "::group::Processing shears/$BRANCH"
10099
101100 case "$BRANCH" in
102101 main) UPSTREAM="upstream/master" ;;
@@ -107,27 +106,35 @@ jobs:
107106
108107 if test 0 = "$(git rev-list --count "origin/shears/$BRANCH..$UPSTREAM")"; then
109108 echo "Nothing to do: $UPSTREAM has no new commits"
109+ echo "::endgroup::"
110110 continue
111111 fi
112112
113113 ./ci/rebase-branch.sh "origin/shears/$BRANCH" "$UPSTREAM" ./ci || {
114+ echo "::endgroup::"
114115 echo "Rebase failed for shears/$BRANCH"
115116 exit 1
116117 }
118+ echo "::endgroup::"
117119 done
118-
119- echo ""
120- echo "All branches processed successfully!"
121120 env :
122121 GH_TOKEN : ${{ secrets.COPILOT_GITHUB_TOKEN }}
123122
123+ - name : Create recovery archive on failure
124+ if : failure() && (steps.rebase-single.outputs.worktree || steps.rebase-all.outputs.worktree)
125+ shell : bash
126+ run : |
127+ worktree="${{ steps.rebase-single.outputs.worktree || steps.rebase-all.outputs.worktree }}"
128+ cd "$worktree"
129+ git bundle create recovery.bundle HEAD REBASE_HEAD refs/rewritten/* 2>/dev/null || true
130+ tar -czf recovery-archive.tar.gz .
131+
124132 - name : Upload recovery archive on failure
125- if : failure()
133+ if : failure() && (steps.rebase-single.outputs.worktree || steps.rebase-all.outputs.worktree)
126134 uses : actions/upload-artifact@v4
127135 with :
128136 name : recovery-archive
129- path : " **/recovery-archive.tar.gz"
130- if-no-files-found : ignore
137+ path : " ${{ steps.rebase-single.outputs.worktree || steps.rebase-all.outputs.worktree }}/recovery-archive.tar.gz"
131138
132139 - name : Push results
133140 if : env.PUSH == 'true'
0 commit comments