Skip to content

Commit f60e9f9

Browse files
committed
fix(workflow-draft_release_hotfix_pr): correct syntax
1 parent ae8109d commit f60e9f9

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

.github/workflows/draft_release_hotfix_pr.yaml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ env:
1313

1414
jobs:
1515
create_draft_pr:
16-
name: Create a draft PR for release/hotfix
16+
name: Create draft PR
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
2020
# only create draft pull requests on pushing to branches 'release/' or 'hotfix/'
21-
if: (startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/'))
21+
if: (startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'hotfix/'))
2222

2323
steps:
2424
- name: Set GitHub token
@@ -28,23 +28,23 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030
with:
31-
ref: ${{ github.head_ref }}
31+
ref: ${{ github.ref_name }}
3232
token: ${{ env.GH_TOKEN }}
3333
# needed by "gh pr create"
3434
fetch-depth: 0
3535

3636
- name: Set environment variables for publishing release
37-
if: startsWith(github.head_ref, 'release/')
37+
if: startsWith(github.ref_name, 'release/')
3838
run: |
39-
BRANCH_NAME="${{ github.head_ref }}"
39+
BRANCH_NAME="${{ github.ref_name }}"
4040
VERSION=${BRANCH_NAME#release/}
4141
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
4242
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
4343
4444
- name: Set environment variables for publishing hotfix
45-
if: startsWith(github.head_ref, 'hotfix/')
45+
if: startsWith(github.ref_name, 'hotfix/')
4646
run: |
47-
BRANCH_NAME="${{ github.head_ref }}"
47+
BRANCH_NAME="${{ github.ref_name }}"
4848
VERSION=${BRANCH_NAME#hotfix/}
4949
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
5050
echo "RELEASE_TYPE=hotfix" >> $GITHUB_ENV
@@ -62,20 +62,15 @@ jobs:
6262
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
6363
6464
- name: Create PR '${{ env.PR_TITLE }}'
65-
env:
66-
PR_LABELS: "automated-pr,${{ env.RELEASE_TYPE}}-pr"
6765
run: |
68-
LABELS=${{ env.PR_LABELS }}
69-
for LABEL in $(echo $LABELS | sed "s/,/ /g"); do gh label create $LABEL --force; done
66+
PR_LABELS="automated-pr,${RELEASE_TYPE}-pr"
67+
for LABEL in $(echo $PR_LABELS | sed "s/,/ /g"); do gh label create $LABEL --force; done
7068
[[ ${PRE_RELEASE:false} == "true" ]] && gh label create 'pre-release' --force
7169
72-
PR_BODY=$(git log ${{ env.BRANCH_MAIN }}..${{ github.head_ref }} --pretty=format:%s)
73-
7470
gh pr create \
7571
--draft \
7672
--base ${{ env.BRANCH_MAIN }} \
77-
--head ${{ github.head_ref }} \
73+
--head ${{ github.ref_name }} \
7874
--title "${{ env.PR_TITLE }}" \
79-
--body "$PR_BODY" \
8075
--label "${{ env.PR_LABELS }}" \
8176
--fill

0 commit comments

Comments
 (0)