File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,27 @@ jobs:
7171 git diff --cached --quiet || git commit -m "chore: bump version [skip ci]"
7272 git push origin HEAD:${{ steps.branch.outputs.name }}
7373
74- - name : Open PR to master
74+ - name : Open or update PR to master
7575 env :
7676 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7777 run : |
78- gh pr create \
79- --base master \
80- --head "${{ steps.branch.outputs.name }}" \
81- --title "chore: bump version (${{ steps.previoustag.outputs.tag }} → ${{ steps.branch.outputs.name }})" \
82- --body "Automated version bump from \`${{ steps.branch.outputs.name }}\`
78+ PR_BODY="Automated version bump from \`${{ steps.branch.outputs.name }}\`
8379
8480 **version.properties:**
8581 \`\`\`
8682 ${{ steps.bump.outputs.result }}
87- \`\`\`" \
88- --label "automated" \
89- || echo "PR already exists, skipping"
83+ \`\`\`"
84+
85+ # Try to create, if it already exists update the body instead
86+ if gh pr create \
87+ --base master \
88+ --head "${{ steps.branch.outputs.name }}" \
89+ --title "chore: bump version (${{ steps.previoustag.outputs.tag }} → ${{ steps.branch.outputs.name }})" \
90+ --body "$PR_BODY"; then
91+ echo "PR created"
92+ else
93+ echo "PR already exists, updating body..."
94+ gh pr edit "${{ steps.branch.outputs.name }}" \
95+ --title "chore: bump version (${{ steps.previoustag.outputs.tag }} → ${{ steps.branch.outputs.name }})" \
96+ --body "$PR_BODY"
97+ fi
You can’t perform that action at this time.
0 commit comments