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
Redesign backport automation around port-commit --from-pr
Move all backport label parsing, per-base looping, idempotency, and error
aggregation into ddev release port-commit --from-pr, backed by unit tests.
Slim backport-pr.yml to a should_run gate job plus a gated backport job, and
use ddev config override in place of the repo-pointing config set calls.
# 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.
111
-
if [ -n "$(gh pr list --repo "${REPO}" --head "${branch}" --state open --json number --jq '.[].number')" ]; then
112
-
echo "::notice::Backport to ${base} already has an open PR (branch ${branch}); skipping."
113
-
continue
114
-
fi
115
-
116
-
# Ensure origin/<base> exists locally for the worktree; a missing branch fails just this base, not the run.
117
-
if ! git fetch --no-tags origin "+refs/heads/${base}:refs/remotes/origin/${base}"; then
118
-
echo "::error::Target branch ${base} does not exist on origin; skipping."
119
-
comment_pr "⚠️ Automatic backport to \`${base}\` skipped: the target branch does not exist."
120
-
overall_rc=1
121
-
continue
122
-
fi
123
-
124
-
echo "::group::Backport #${PR_NUMBER} to ${base}"
125
-
# Pass the merge SHA we already have rather than PR-<n>, which would round-trip via the API back to this commit.
126
-
if ddev --no-interactive release port-commit "${MERGE_SHA}" \
127
-
--target-branch "${base}" \
128
-
--branch-prefix backport \
129
-
--pr-labels "backport,bot"; then
130
-
pr_url="$(gh pr list --repo "${REPO}" --head "${branch}" --state open --json url --jq '.[0].url // ""' || true)"
131
-
echo "::notice::Opened backport PR for ${base}: ${pr_url}"
132
-
if [ -n "${pr_url}" ]; then
133
-
comment_pr "Backport to \`${base}\` opened: ${pr_url}"
134
-
fi
135
-
else
136
-
echo "::error::Backport to ${base} failed."
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."
`release port-commit --from-pr <number>` backports a merged PR to every `backport/<base>` label on it, deriving the commit and target branches from the PR and skipping bases whose backport PR already exists.
1
2
`release port-commit` now resets `.deps/` in addition to `.in-toto` when porting a commit, so resolved dependency lockfiles are taken from the target branch.
0 commit comments