Skip to content

Commit 249f15a

Browse files
committed
Document stale backport branch cleanup in workflow
The open-PR pre-check only detects an OPEN backport PR, so a branch left by a run that failed before opening the PR (or whose PR was later closed) is not auto-cleaned and port-commit's push is rejected non-fast-forward. Document the limitation at the pre-check and, in the failure comment, tell the operator to delete the stale branch and retry. Manual cleanup is the accepted remedy.
1 parent e0803d1 commit 249f15a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.github/workflows/backport-pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
# Mirror port-commit's branch naming so we can detect an existing backport before doing work.
107107
branch="$(printf '%s' "${DD_GITHUB_USER}/backport-${sha10}-to-${base}" | tr '[:upper:]' '[:lower:]')"
108108
109+
# Only an OPEN backport PR is detected. A branch left by a failed prior run (no open PR) is not
110+
# auto-cleaned; port-commit's push then fails non-fast-forward until the stale branch is deleted manually.
109111
if [ -n "$(gh pr list --repo "${REPO}" --head "${branch}" --state open --json number --jq '.[].number')" ]; then
110112
echo "::notice::Backport to ${base} already has an open PR (branch ${branch}); skipping."
111113
continue
@@ -132,7 +134,7 @@ jobs:
132134
fi
133135
else
134136
echo "::error::Backport to ${base} failed."
135-
comment_pr "⚠️ Automatic backport to \`${base}\` failed. See the [workflow run](${RUN_URL}) for details, or backport manually with \`ddev release port-commit PR-${PR_NUMBER} --target-branch ${base}\`."
137+
comment_pr "⚠️ Automatic backport to \`${base}\` failed. See the [workflow run](${RUN_URL}) for details, or backport manually with \`ddev release port-commit PR-${PR_NUMBER} --target-branch ${base}\`. If the push was rejected as non-fast-forward, delete the stale \`${branch}\` branch and retry."
136138
overall_rc=1
137139
fi
138140
echo "::endgroup::"

0 commit comments

Comments
 (0)