feat(release): rebase PR branch before updating changelog
When updating an existing release PR, the workflow now rebases the next-release branch onto the base branch using Gitea's PR update API with style=rebase. This keeps the PR up to date with main without force-pushing or deleting the branch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,10 @@
|
|||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(but --help:*)",
|
"Bash(but --help:*)",
|
||||||
"Bash(but rub --help:*)"
|
"Bash(but rub --help:*)",
|
||||||
|
"WebSearch",
|
||||||
|
"WebFetch(domain:docs.gitea.com)",
|
||||||
|
"WebFetch(domain:gitea.com)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,22 @@ jobs:
|
|||||||
"${API_URL}/pulls?state=open" | jq '[.[] | select(.head.ref == "next-release")]')
|
"${API_URL}/pulls?state=open" | jq '[.[] | select(.head.ref == "next-release")]')
|
||||||
PR_INDEX=$(echo "${PRS}" | jq -r '.[0].number // empty')
|
PR_INDEX=$(echo "${PRS}" | jq -r '.[0].number // empty')
|
||||||
|
|
||||||
|
# If PR exists, rebase the branch onto the latest base branch
|
||||||
|
if [ -n "${PR_INDEX}" ]; then
|
||||||
|
echo "Rebasing PR #${PR_INDEX} branch onto ${BASE_BRANCH}..."
|
||||||
|
REBASE_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
"${API_URL}/pulls/${PR_INDEX}/update?style=rebase")
|
||||||
|
REBASE_CODE=$(echo "${REBASE_RESPONSE}" | tail -1)
|
||||||
|
if [ "${REBASE_CODE}" = "200" ]; then
|
||||||
|
echo "Successfully rebased branch onto ${BASE_BRANCH}"
|
||||||
|
elif [ "${REBASE_CODE}" = "409" ]; then
|
||||||
|
echo "Branch already up to date or rebase conflict - continuing with update"
|
||||||
|
else
|
||||||
|
echo "Warning: Rebase returned ${REBASE_CODE}, continuing anyway"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Checking for existing next-release branch..."
|
echo "Checking for existing next-release branch..."
|
||||||
BRANCH_CHECK=$(curl -s -w "%{http_code}" -o /dev/null \
|
BRANCH_CHECK=$(curl -s -w "%{http_code}" -o /dev/null \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
|||||||
Reference in New Issue
Block a user