Build/Test Tools: Include the commit short summary in Slack messages.

This gives more context to GitHub Action related Slack messages without the need to click the workflow URL, or unfurl the links (which shows lots of unnecessary information, such as the repository description and image).

Props earnjam.
See .

git-svn-id: https://develop.svn.wordpress.org/trunk@51647 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2021-08-20 18:58:18 +00:00
parent ee81f71ac6
commit 40506e7e64

@ -60,9 +60,18 @@ jobs:
id: previous-conclusion
run: echo "::set-output name=previous_conclusion::${{ steps.previous-result.outputs.result }}"
- name: Prepare commit message.
id: commit-message
run: |
COMMIT_MESSAGE=$(cat <<'EOF' | awk 'NR==1' | sed 's/\"/\\"/g'
${{ github.event.workflow_run.head_commit.message }}
EOF
)
echo "::set-output name=commit_message_escaped::${COMMIT_MESSAGE}"
- name: Construct payload and store as an output
id: create-payload
run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.event.workflow_run.name }}\",\"ref_name\":\"${{ github.event.workflow_run.head_branch }}\",\"run_url\":\"${{ github.event.workflow_run.html_url }}\"}"
run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.event.workflow_run.name }}\",\"ref_name\":\"${{ github.event.workflow_run.head_branch }}\",\"run_url\":\"${{ github.event.workflow_run.html_url }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"
# Posts notifications when a workflow fails.
failure: