Skip to content

Commit 1a7b6e8

Browse files
committed
fix(workflow-draft_release_hotfix_pr): ignore creating PR if it exists, add custom PR description
1 parent f60e9f9 commit 1a7b6e8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/draft_release_hotfix_pr.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,24 @@ jobs:
6262
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
6363
6464
- name: Create PR '${{ env.PR_TITLE }}'
65+
env:
66+
PR_BODY: |
67+
This PR was created to prepare for releasing ${{ env.TAG_PREFIX }}${{ env.RELEASE_VERSION }}.
68+
69+
Merging this PR will create the GitHub release ${{ env.TAG_PREFIX }}${{ env.RELEASE_VERSION }}.
6570
run: |
6671
PR_LABELS="automated-pr,${RELEASE_TYPE}-pr"
6772
for LABEL in $(echo $PR_LABELS | sed "s/,/ /g"); do gh label create $LABEL --force; done
6873
[[ ${PRE_RELEASE:false} == "true" ]] && gh label create 'pre-release' --force
6974
70-
gh pr create \
71-
--draft \
72-
--base ${{ env.BRANCH_MAIN }} \
73-
--head ${{ github.ref_name }} \
74-
--title "${{ env.PR_TITLE }}" \
75-
--label "${{ env.PR_LABELS }}" \
76-
--fill
75+
PR_ID=$(gh pr list --state open --search "base:${{ env.BRANCH_MAIN }} head:${{ github.ref_name }}" | head -1 | cut -f1)
76+
[[ ! -z "$PR_ID" ]] && \
77+
gh pr create \
78+
--draft \
79+
--base "${{ env.BRANCH_MAIN }}" \
80+
--head "${{ github.ref_name }}" \
81+
--title "${{ env.PR_TITLE }}" \
82+
--body "${{ env.PR_BODY }}" \
83+
--label "${PR_LABELS}" \
84+
--fill \
85+
|| echo "PR was created. Ignored!"

0 commit comments

Comments
 (0)