13
13
14
14
jobs :
15
15
create_draft_pr :
16
- name : Create a draft PR for release/hotfix
16
+ name : Create draft PR
17
17
runs-on : ubuntu-latest
18
18
permissions :
19
19
contents : write
20
20
# 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/'))
22
22
23
23
steps :
24
24
- name : Set GitHub token
@@ -28,23 +28,23 @@ jobs:
28
28
- name : Checkout repository
29
29
uses : actions/checkout@v3
30
30
with :
31
- ref : ${{ github.head_ref }}
31
+ ref : ${{ github.ref_name }}
32
32
token : ${{ env.GH_TOKEN }}
33
33
# needed by "gh pr create"
34
34
fetch-depth : 0
35
35
36
36
- name : Set environment variables for publishing release
37
- if : startsWith(github.head_ref , 'release/')
37
+ if : startsWith(github.ref_name , 'release/')
38
38
run : |
39
- BRANCH_NAME="${{ github.head_ref }}"
39
+ BRANCH_NAME="${{ github.ref_name }}"
40
40
VERSION=${BRANCH_NAME#release/}
41
41
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
42
42
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
43
43
44
44
- name : Set environment variables for publishing hotfix
45
- if : startsWith(github.head_ref , 'hotfix/')
45
+ if : startsWith(github.ref_name , 'hotfix/')
46
46
run : |
47
- BRANCH_NAME="${{ github.head_ref }}"
47
+ BRANCH_NAME="${{ github.ref_name }}"
48
48
VERSION=${BRANCH_NAME#hotfix/}
49
49
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
50
50
echo "RELEASE_TYPE=hotfix" >> $GITHUB_ENV
@@ -62,20 +62,15 @@ jobs:
62
62
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
63
63
64
64
- name : Create PR '${{ env.PR_TITLE }}'
65
- env :
66
- PR_LABELS : " automated-pr,${{ env.RELEASE_TYPE}}-pr"
67
65
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
70
68
[[ ${PRE_RELEASE:false} == "true" ]] && gh label create 'pre-release' --force
71
69
72
- PR_BODY=$(git log ${{ env.BRANCH_MAIN }}..${{ github.head_ref }} --pretty=format:%s)
73
-
74
70
gh pr create \
75
71
--draft \
76
72
--base ${{ env.BRANCH_MAIN }} \
77
- --head ${{ github.head_ref }} \
73
+ --head ${{ github.ref_name }} \
78
74
--title "${{ env.PR_TITLE }}" \
79
- --body "$PR_BODY" \
80
75
--label "${{ env.PR_LABELS }}" \
81
76
--fill
0 commit comments