@@ -236,6 +236,7 @@ jobs:
236236 - uses : actions/checkout@v5
237237 with :
238238 fetch-depth : 0
239+ token : ${{ secrets.PAT_TOKEN }}
239240
240241 - name : Configure Git
241242 run : |
@@ -310,6 +311,10 @@ jobs:
310311 if : env.VERSION_UPDATED == 'true' && steps.ff-main.outputs.fast_forward == 'true'
311312 run : |
312313 BRANCH="chore/version-bump-${{ env.NEXT_VERSION }}"
314+
315+ # Delete remote branch if it exists
316+ git push origin --delete "$BRANCH" 2>/dev/null || true
317+
313318 git checkout -b "$BRANCH"
314319 git add Cargo.toml
315320 git commit -m "chore: bump version to ${{ env.NEXT_VERSION }}"
@@ -320,18 +325,25 @@ jobs:
320325 - name : Create PR for version bump
321326 if : env.VERSION_UPDATED == 'true' && steps.ff-main.outputs.fast_forward == 'true'
322327 env :
323- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
328+ GH_TOKEN : ${{ secrets.PAT_TOKEN }}
324329 run : |
325- gh pr create \
326- --base main \
327- --head "${{ env.BUMP_BRANCH }}" \
328- --title "chore: bump version to ${{ env.NEXT_VERSION }}" \
329- --body "Automatic version bump after release. Prepare ${{ env.NEXT_VERSION }} as next release candidate."
330+ # Check if PR already exists
331+ EXISTING_PR=$(gh pr list --head "${{ env.BUMP_BRANCH }}" --base main --json number --jq '.[0].number' 2>/dev/null || echo "")
332+
333+ if [ -n "$EXISTING_PR" ]; then
334+ echo "PR #$EXISTING_PR already exists, skipping creation"
335+ else
336+ gh pr create \
337+ --base main \
338+ --head "${{ env.BUMP_BRANCH }}" \
339+ --title "chore: bump version to ${{ env.NEXT_VERSION }}" \
340+ --body "Automatic version bump after release. Prepare ${{ env.NEXT_VERSION }} as next release candidate."
341+ fi
330342
331343 - name : Create PR (non fast-forward)
332344 if : steps.ff-main.outputs.fast_forward == 'false'
333345 env :
334- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
346+ GH_TOKEN : ${{ secrets.PAT_TOKEN }}
335347 run : |
336348 gh pr create \
337349 --base main \
0 commit comments