diff --git a/examples/github-action/trigger-github-action.json b/examples/github-action/trigger-github-action.json index 7890ebd..dea133b 100644 --- a/examples/github-action/trigger-github-action.json +++ b/examples/github-action/trigger-github-action.json @@ -4,8 +4,8 @@ "help": "bashbot trigger-github-action", "trigger": "trigger-github-action", "location": "./examples/github-action", - "setup": "export REPO_OWNER=mathew-fleisch && export REPO_NAME=bashbot && export SLACK_CHANNEL=$TRIGGERED_CHANNEL_ID && export SLACK_USERID=$TRIGGERED_USER_ID", - "command": "./trigger.sh", + "setup": "export REPO_OWNER=mathew-fleisch && export REPO_NAME=bashbot && export SLACK_CHANNEL=${TRIGGERED_CHANNEL_ID} && export SLACK_USERID=${TRIGGERED_USER_ID}", + "command": "./trigger.sh && echo \"Running this \"", "parameters": [], "log": false, "ephemeral": false, diff --git a/examples/github-action/trigger.sh b/examples/github-action/trigger.sh index bc9a8eb..8ef045c 100755 --- a/examples/github-action/trigger.sh +++ b/examples/github-action/trigger.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2086 github_base="${github_base:-api.github.com}" expected_variables="BASHBOT_CONFIG_FILEPATH SLACK_TOKEN SLACK_CHANNEL SLACK_USERID REPO_OWNER REPO_NAME GITHUB_TOKEN" @@ -6,10 +7,12 @@ for expect in $expected_variables; do if [[ -z "${!expect}" ]]; then echo "Missing environment variable $expect" echo "Expected: $expected_variables" - exit 1 + exit 0 fi done -headers="-sH \"Accept: application/vnd.github.everest-preview+json\" -H \"Authorization: token ${GITHUB_TOKEN}\" -X POST" -curl ${headers} \ +curl -s \ + -X POST \ + -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ --data '{"event_type":"trigger-github-action","client_payload": {"channel":"'${SLACK_CHANNEL}'", "user_id": "'${SLACK_USERID}'"}}' \ - https://${github_base}/repos/${REPO_OWNER}/${REPO_NAME}/dispatches + "https://${github_base}/repos/${REPO_OWNER}/${REPO_NAME}/dispatches"