mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #14247 from ethereum/replace-envsubst
Replace `envsubst` by `sed` in `matrix_notification` script
This commit is contained in:
commit
9eaa5cebdb
@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s inherit_errexit
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(dirname "$0")"
|
SCRIPT_DIR="$(dirname "$0")"
|
||||||
|
|
||||||
@ -28,6 +27,7 @@ function notify() {
|
|||||||
curl "https://${MATRIX_SERVER}/_matrix/client/v3/rooms/${MATRIX_NOTIFY_ROOM_ID}/send/m.room.message" \
|
curl "https://${MATRIX_SERVER}/_matrix/client/v3/rooms/${MATRIX_NOTIFY_ROOM_ID}/send/m.room.message" \
|
||||||
--request POST \
|
--request POST \
|
||||||
--include \
|
--include \
|
||||||
|
--fail \
|
||||||
--header "Content-Type: application/json" \
|
--header "Content-Type: application/json" \
|
||||||
--header "Accept: application/json" \
|
--header "Accept: application/json" \
|
||||||
--header "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" \
|
--header "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" \
|
||||||
@ -63,10 +63,14 @@ function format_predefined_message() {
|
|||||||
|
|
||||||
[[ -z "$template" ]] && fail "Message template for event [$event] not defined."
|
[[ -z "$template" ]] && fail "Message template for event [$event] not defined."
|
||||||
|
|
||||||
# Export variables that must be substituted
|
# shellcheck disable=SC2016
|
||||||
export WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM
|
sed -e 's|${WORKFLOW_NAME}|'"${WORKFLOW_NAME}"'|' \
|
||||||
envsubst < "$template"
|
-e 's|${JOB}|'"${JOB}"'|' \
|
||||||
unset WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM
|
-e 's|${BRANCH}|'"${BRANCH}"'|' \
|
||||||
|
-e 's|${TAG}|'"${TAG}"'|' \
|
||||||
|
-e 's|${BUILD_URL}|'"${BUILD_URL}"'|' \
|
||||||
|
-e 's|${BUILD_NUM}|'"${BUILD_NUM}"'|' \
|
||||||
|
"$template"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set message environment variables based on CI backend
|
# Set message environment variables based on CI backend
|
||||||
|
Loading…
Reference in New Issue
Block a user