more flexiable
This commit is contained in:
parent
65e38d7faa
commit
73fed0e15e
|
@ -8,8 +8,8 @@ inputs:
|
||||||
dingToken:
|
dingToken:
|
||||||
description: 'DingDing bot token'
|
description: 'DingDing bot token'
|
||||||
required: true
|
required: true
|
||||||
message:
|
body:
|
||||||
description: 'Message to send'
|
description: 'Post Body to send'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
|
|
|
@ -6,24 +6,16 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${INPUT_MESSAGE}" ]
|
if [ -z "${INPUT_BODY}" ]
|
||||||
then
|
then
|
||||||
echo "message is required!"
|
echo "body is required!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
url="https://oapi.dingtalk.com/robot/send?access_token=${INPUT_DINGTOKEN}"
|
echo "body: $INPUT_BODY"
|
||||||
|
|
||||||
body=$(cat <<EOF
|
url="https://oapi.dingtalk.com/robot/send?access_token=${INPUT_DINGTOKEN}"
|
||||||
{
|
|
||||||
"msgtype": "text",
|
|
||||||
"text": {
|
|
||||||
"content": "${INPUT_MESSAGE}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
curl "$url" \
|
curl "$url" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "${body}"
|
-d "${INPUT_BODY}"
|
||||||
|
|
Loading…
Reference in New Issue