mirror of
git://develop.git.wordpress.org/
synced 2025-04-12 16:15:07 +02:00
Build/Test Tools: Remove redundant escaping from the commit message that's passed to the Slack API.
This escaping is no longer needed since all instances of inline expressions were removed from workflows in r59679. The commit message can now be treated as a plain text string in an environment variable throughout the workflow. Props johnbillion, swissspidy Unprops johnblackbourn See #62221 git-svn-id: https://develop.svn.wordpress.org/trunk@59920 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e6fa3b914c
commit
24a47a419a
13
.github/workflows/slack-notifications.yml
vendored
13
.github/workflows/slack-notifications.yml
vendored
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user