Skip to content

Commit ccd024b

Browse files
Merge pull request #461 from dekusms/dev
Modify PR creation step for version bump workflow
2 parents 7ce0e53 + 26907a0 commit ccd024b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/staging-version-bump.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)