Merge pull request 'feat(release): rebase PR branch before updating changelog' (#14) from feat-rebase-pr into main
Reviewed-on: #14
This commit was merged in pull request #14.
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"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")]')
|
||||
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..."
|
||||
BRANCH_CHECK=$(curl -s -w "%{http_code}" -o /dev/null \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
|
||||
Reference in New Issue
Block a user