Skip to content

Commit c91c957

Browse files
ci: Work out ci string parsing (#48)
Last PR failed due to simple string issue/ Testing CI issues when we use single quotes in the commit message. contraction: y'all 'single quotes' "double quotes" `backtics` Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent d016a5c commit c91c957

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

.github/workflows/update-repo-stuff.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ jobs:
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
@@ -59,8 +60,8 @@ jobs:
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+
uses: crazy-max/[email protected]
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+
uses: crazy-max/[email protected]
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+
uses: crazy-max/[email protected]
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+
uses: crazy-max/[email protected]
282280

283281
- name: Checkout PR branch
284282
env:

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Add MSRV badge ([#36](https://github.com/tjtelan/git-url-parse-rs/issues/36))
1414
- Add personal access token to checkout ([#41](https://github.com/tjtelan/git-url-parse-rs/issues/41))
1515
- Add pre-merge generated updates ([#42](https://github.com/tjtelan/git-url-parse-rs/issues/42))
16+
- Add support for wasm32-unknown-unknown compilation target ([#44](https://github.com/tjtelan/git-url-parse-rs/issues/44))
1617

1718
### Fixed
1819

@@ -27,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2728

2829
- Troubleshoot CI commit fail ([#39](https://github.com/tjtelan/git-url-parse-rs/issues/39))
2930
- Troubleshoot Post PR ([#40](https://github.com/tjtelan/git-url-parse-rs/issues/40))
30-
- Labels and MSRV tuning ([#47](https://github.com/tjtelan/git-url-parse-rs/issues/47))
31+
- Work out ci string parsing ([#48](https://github.com/tjtelan/git-url-parse-rs/issues/48))
3132

3233
## [0.4.2](https://github.com/tjtelan/git-url-parse-rs/tree/v0.4.2) - 2022-05-30
3334

0 commit comments

Comments
 (0)