Skip to content

Commit 895a82d

Browse files
committed
Try suggestion
1 parent 420d353 commit 895a82d

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

action.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ runs:
3232
shell: bash
3333
run: |
3434
{
35-
echo "commit_message<<EOF"
36-
echo ${{ toJSON(github.event.head_commit.message) }}
37-
echo "EOF"
35+
printf "commit_message<<EOF"
36+
printf ${{ toJSON(github.event.head_commit.message) }}
37+
printf "EOF"
3838
} >> $GITHUB_ENV
3939
{
40-
echo "input_message<<EOF"
41-
echo ${{ toJSON(inputs.message) }}
42-
echo "EOF"
40+
printf "input_message<<EOF"
41+
printf ${{ toJSON(inputs.message) }}
42+
printf "EOF"
4343
} >> $GITHUB_ENV
4444
- name: Set fields
4545
shell: bash
4646
if: always()
4747
id: fields
4848
run: |
49-
echo
49+
echo "Made it here!"
5050
if [ "${{ inputs.status }}" = "success" ]; then
5151
echo "emoji=large_green_square" >> $GITHUB_OUTPUT
5252
echo "color=good" >> $GITHUB_OUTPUT
@@ -61,17 +61,16 @@ runs:
6161
if [ ! -z "$input_message" ]; then
6262
message=$input_message
6363
elif [ ! -z "$commit_message" ]; then
64-
# get commit message from `push` trigger
65-
commit_message=$(echo "$commit_message" | head -n 1)
66-
message="<https://github.com/${{ inputs.repository }}/commit/${{ github.sha }}|$commit_message>"
64+
commit_msg_line=$(printf '%s\n' "$commit_message" | head -n 1)
65+
message=$(printf '<https://github.com/%s/commit/%s|%s>' "${{ inputs.repository }}" "${{ github.sha }}" "$commit_msg_line")
6766
elif git rev-parse --is-inside-git-dir > /dev/null 2>&1; then
68-
# get commit message from the current git directory to support `workflow_dispatch` trigger
69-
commit_message=$(git log --format=%B -n 1 | head -n 1)
70-
message="<https://github.com/${{ inputs.repository }}/commit/${{ github.sha }}|$commit_message>"
67+
commit_msg_line=$(git log --format=%B -n 1 | head -n 1)
68+
message=$(printf '<https://github.com/%s/commit/%s|%s>' "${{ inputs.repository }}" "${{ github.sha }}" "$commit_msg_line")
7169
else
72-
commit_message="Link to the latest commit in the repository"
73-
message="<https://github.com/${{ inputs.repository }}/commit/${{ github.sha }}|$commit_message>"
70+
commit_msg_line="Link to the latest commit in the repository"
71+
message=$(printf '<https://github.com/%s/commit/%s|%s>' "${{ inputs.repository }}" "${{ github.sha }}" "$commit_msg_line")
7472
fi
73+
7574
{
7675
echo "message<<EOF"
7776
echo "$message"

0 commit comments

Comments
 (0)