File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,16 +11,18 @@ git config user.email "github-actions[bot]@users.noreply.github.com"
1111# Create new branch
1212BRANCH_NAME=" web-sdk-${SDK_VERSION} -release"
1313
14- # Check if PR already exists
15- EXISTING_PR= $( curl -s \
14+ # Close any existing PRs for this branch
15+ curl -s \
1616 -H " Authorization: Bearer $GH_TURBINE_TOKEN " \
1717 " https://api.github.com/repos/OneSignal/turbine/pulls?head=OneSignal:$BRANCH_NAME &state=open" |
18- jq length)
19-
20- if [ " $EXISTING_PR " -gt 0 ]; then
21- echo " PR already exists for branch $BRANCH_NAME "
22- exit 0
23- fi
18+ jq -r ' .[].number' | while read PR_NUM; do
19+ echo " Closing existing PR #$PR_NUM "
20+ curl -sS -X PATCH \
21+ -H " Authorization: Bearer $GH_TURBINE_TOKEN " \
22+ -H " Content-Type: application/json" \
23+ -d ' {"state": "closed"}' \
24+ " https://api.github.com/repos/OneSignal/turbine/pulls/$PR_NUM "
25+ done
2426
2527git checkout -B " $BRANCH_NAME "
2628
You can’t perform that action at this time.
0 commit comments