diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml index af5b75c8ef..3ba1c193a8 100644 --- a/.github/workflows/slack-notifications.yml +++ b/.github/workflows/slack-notifications.yml @@ -135,6 +135,7 @@ jobs: with: retries: 2 retry-exempt-status-codes: 418 + result-encoding: string script: | const commit_details = await github.rest.repos.getCommit({ owner: context.repo.owner, @@ -143,18 +144,10 @@ jobs: }); return commit_details.data.commit.message; - - name: Prepare commit message. - id: commit-message - run: | - # shellcheck disable=SC2016 - COMMIT_MESSAGE="$(echo "${COMMIT_MSG_RAW}" | awk 'NR==1' | sed 's/`/\\`/g' | sed 's/\"/\\\\\\"/g' | sed 's/\$/\\$/g')" - echo "commit_message_escaped=${COMMIT_MESSAGE}" >> "$GITHUB_OUTPUT" - env: - COMMIT_MSG_RAW: ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }} - - name: Construct payload and store as an output id: create-payload run: | + COMMIT_MSG="$(echo "${COMMIT_MSG_RAW}" | awk 'NR==1')" PAYLOAD="$( jq \ -n \ --arg workflow_name "${GITHUB_WORKFLOW}" \ @@ -165,7 +158,7 @@ jobs: )" echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT" env: - COMMIT_MSG: ${{ steps.commit-message.outputs.commit_message_escaped }} + COMMIT_MSG_RAW: ${{ ( github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && fromJson( steps.current-commit-message.outputs.result ) || github.event.head_commit.message }} # Posts notifications when a workflow fails. failure: