feat(release): rebase PR branch before updating changelog #14

Merged
argoyle merged 1 commits from feat-rebase-pr into main 2026-01-09 20:10:11 +00:00
2 changed files with 20 additions and 1 deletions
+4 -1
View File
@@ -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)"
] ]
} }
} }
+16
View File
@@ -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}" \