Skip to content

Commit

Permalink
fix: single quote(') in commit_message would lead to failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranf committed Sep 18, 2024
1 parent 4623574 commit a41018b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
token: ${{ secrets.SCRIBD_SLACK_GENERIC_TOKEN_PUBLIC }}
channel: test-release-notification
message: <https://scribd.com|Special characters + "quotes" + `backtick`>
message: <https://scribd.com|Special characters + 'single quote' + "double quotes" + `backtick`>
test-overwrite-repository:
runs-on: ubuntu-22.04
steps:
Expand Down
11 changes: 7 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ runs:
using: composite
steps:
- name: Set fields
env:
input_message: ${{ inputs.message }}
commit_message: ${{ github.event.head_commit.message }}
shell: bash
if: always()
id: fields
Expand All @@ -43,11 +46,11 @@ runs:
echo "color=warning" >> $GITHUB_OUTPUT
fi
if [ ! -z '${{ inputs.message }}' ]; then
message='${{ inputs.message }}'
elif [ ! -z '${{ github.event.head_commit.message }}' ]; then
if [ ! -z "$input_message" ]; then
message=$input_message
elif [ ! -z "$commit_message" ]; then
# get commit message from `push` trigger
commit_message=$(echo '${{ github.event.head_commit.message }}' | head -n 1)
commit_message=$(echo "$commit_message" | head -n 1)
message="<https://github.com/${{ inputs.repository }}/commit/${{ github.sha }}|$commit_message>"
elif git rev-parse --is-inside-git-dir > /dev/null 2>&1; then
# get commit message from the current git directory to support `workflow_dispatch` trigger
Expand Down

0 comments on commit a41018b

Please sign in to comment.