Skip to content

Commit

Permalink
bug: 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 3e00998
Show file tree
Hide file tree
Showing 2 changed files with 11 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
14 changes: 10 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,14 @@ runs:
echo "color=warning" >> $GITHUB_OUTPUT
fi
if [ ! -z '${{ inputs.message }}' ]; then
message='${{ inputs.message }}'
elif [ ! -z '${{ github.event.head_commit.message }}' ]; then
echo "input_message=$input_message"
echo "commit_message=$commit_message"
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 3e00998

Please sign in to comment.