allow silent curl

This commit is contained in:
jon4h
2021-03-24 01:36:57 +01:00
parent 530779ed63
commit 69dc31bf67
2 changed files with 27 additions and 7 deletions

View File

@@ -163,10 +163,19 @@ authentication is assumed not to be required. If configured, it must follow the
The default endpoint type is JSON. The argument is only required if you wish to send urlencoded form data.
Otherwise it's optional. <br/><br/>
```yml
silent: true
```
To hide the output from curl set the argument `silent` to `true`. The default value is `false`.<br/><br/>
```yml
data: "Additional JSON or URL encoded data"
```
Additional data to include in the payload. It is optional. This data will attempted to be
merged 'as-is' with the existing payload, and is expected to already be sanitized and valid.

View File

@@ -71,10 +71,21 @@ if [ -n "$webhook_auth" ]; then
WEBHOOK_ENDPOINT="-u $webhook_auth $webhook_url"
fi
curl -k -v --fail \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT
if [ "$silent"]; then
curl -k -v --fail -s \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT
else
curl -k -v --fail \
-H "Content-Type: $CONTENT_TYPE" \
-H "User-Agent: User-Agent: GitHub-Hookshot/760256b" \
-H "X-Hub-Signature: sha1=$WEBHOOK_SIGNATURE" \
-H "X-GitHub-Delivery: $GITHUB_RUN_NUMBER" \
-H "X-GitHub-Event: $GITHUB_EVENT_NAME" \
--data "$WEBHOOK_DATA" $WEBHOOK_ENDPOINT
fi