diff --git a/action.yml b/action.yml index 75b34d3..4678d54 100644 --- a/action.yml +++ b/action.yml @@ -31,14 +31,18 @@ runs: env: input_message: ${{ inputs.message }} commit_message: ${{ github.event.head_commit.message }} + status: ${{ inputs.status }} + repository: ${{ inputs.repository }} + event_pusher_name: ${{ github.event.pusher.name }} + event_sender_login: ${{ github.event.sender.login }} shell: bash if: always() id: fields run: | - if [ "${{ inputs.status }}" = "success" ]; then + if [ "$status" = "success" ]; then echo "emoji=large_green_square" >> $GITHUB_OUTPUT echo "color=good" >> $GITHUB_OUTPUT - elif [ "${{ inputs.status }}" = "failure" ]; then + elif [ "$status" = "failure" ]; then echo "emoji=large_red_square" >> $GITHUB_OUTPUT echo "color=danger" >> $GITHUB_OUTPUT else @@ -47,23 +51,23 @@ runs: fi if [ ! -z "$input_message" ]; then - message=$input_message + message="$input_message" elif [ ! -z "$commit_message" ]; then # get commit message from `push` trigger commit_message=$(echo "$commit_message" | head -n 1) - message="" - elif git rev-parse --is-inside-git-dir > /dev/null 2>&1; then + 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 commit_message=$(git log --format=%B -n 1 | head -n 1) - message="" + message="" else commit_message="Link to the latest commit in the repository" - message="" + message="" fi echo "message=$message" >> $GITHUB_OUTPUT - author=${{ github.event.pusher.name }} # context from `push` trigger - author=${author:-${{ github.event.sender.login }}} # context from `workflow_dispatch` trigger + author="$event_pusher_name" # context from `push` trigger + author="${author:-$event_sender_login}" # context from `workflow_dispatch` trigger echo "author=$author" >> $GITHUB_OUTPUT - name: Send notification