4545 id : pr
4646 if : github.event_name == 'push' && github.ref == 'refs/heads/staging'
4747 run : |
48- NUMBER=$( echo '${{ github.event.head_commit.message }}' | head -1 | tr -cd [:digit:] )
48+ git log --format=%B -n 1 $GITHUB_SHA | head -1 > /tmp/commit_msg
4949
50+ NUMBER=$( cat /tmp/commit_msg | head -1 | tr -cd [:digit:] )
5051 echo "PR number is: $NUMBER"
5152 echo "::set-output name=number::$NUMBER"
5253
5960 outputs :
6061 pr_number : ${{ steps.pr.outputs.number }}
6162 steps :
62- # - name: Dump context
63- # uses: crazy-max/[email protected] 63+ - name : Dump context
64+ 6465
6566 - name : Print PR number
6667 id : pr
@@ -109,8 +110,8 @@ jobs:
109110 id : info
110111 uses : Brymastr/pr-info-action@v1
111112
112- # - name: Dump context
113- # uses: crazy-max/[email protected] 113+ - name : Dump context
114+ 114115
115116 - name : Set outputs from pull request event
116117 if : github.event_name == 'pull_request'
@@ -123,13 +124,14 @@ jobs:
123124 if : github.event_name == 'push'
124125 run : |
125126 echo "PR_BRANCH='$(git rev-parse --abbrev-ref HEAD)'" >> $GITHUB_ENV
126- echo "PR_BRANCH=' $(git rev-parse --abbrev-ref HEAD)' "
127+ echo "PR_BRANCH=$(git rev-parse --abbrev-ref HEAD)"
127128 echo "PR_NUMBER='${{ needs.get_pr_number.outputs.pr_number }}'" >> $GITHUB_ENV
128129 echo "PR_NUMBER='${{ needs.get_pr_number.outputs.pr_number }}'"
129130
131+ # Might need to b64 encode titles, so they can avoid exec from print later on
130132 # The commit message can be multiple lines, but we only want the first one
131- echo '${{ github.event.head_commit.message }}' > /tmp/pr-title-tmp
132- cat /tmp/pr-title-tmp | head -1 > /tmp/pr-title
133+
134+ git log --format=%B -n 1 $GITHUB_SHA | head -1 | base64 > /tmp/pr-title
133135 echo PR_TITLE="$(cat /tmp/pr-title)" >> $GITHUB_ENV
134136 echo PR_TITLE="$(cat /tmp/pr-title)"
135137
@@ -146,7 +148,7 @@ jobs:
146148 echo "pr number is: $PR_NUMBER"
147149
148150 echo "::set-output name=title::$PR_TITLE"
149- echo "pr title is: $PR_TITLE"
151+ echo "b64 encoded pr title is: $PR_TITLE"
150152
151153 # This isn't working as expected
152154 # bot-label-check:
@@ -181,21 +183,17 @@ jobs:
181183 git config user.name "${{ env.GIT_BOT_USERNAME }}"
182184 git config user.email "${{ env.GIT_BOT_EMAIL }}"
183185
184- # - name: Dump context
185- # uses: crazy-max/[email protected] 186+ - name : Dump context
187+ 186188
187189 - name : Simulate PR merge for changelog updates
188190 run : |
189191 git checkout ${{ env.DEFAULT_BRANCH }}
190192
191- if [[ ${{ github.event_name == 'pull_request' }} = 'true' ]]; then
192- git commit --all --allow-empty -m "${{ needs.get_pr_info.outputs.pr_title }} (#${{ needs.get_pr_info.outputs.pr_number }})"
193- fi
194-
195- if [[ ${{ github.event_name == 'push' }} = 'true' ]]; then
196- git commit --all --allow-empty -m "${{ needs.get_pr_info.outputs.pr_title }}"
197- fi
193+ # Write commit into file, so we don't have to
194+ echo ${{ needs.get_pr_info.outputs.pr_title }} | base64 -d > /tmp/commit_title
198195
196+ git commit --all --allow-empty -F /tmp/commit_title
199197 git log -5
200198
201199 - name : Generate a changelog
@@ -277,8 +275,8 @@ jobs:
277275 token : ${{ steps.app.outputs.token }}
278276 fetch-depth : 0
279277
280- # - name: Dump context
281- # uses: crazy-max/[email protected] 278+ - name : Dump context
279+ 282280
283281 - name : Checkout PR branch
284282 env :
0 commit comments