Skip to content

Commit

Permalink
feat: parameterize the ref name and add some checks before running th…
Browse files Browse the repository at this point in the history
…e curl
  • Loading branch information
venkatamutyala committed Oct 14, 2024
1 parent 752bd32 commit a714c69
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion github-workflow-dispatcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@
set -e



# Check if required variables are set
if [ -z "${GITHUB_DISPATCH_URL}" ]; then
echo "Error: GITHUB_DISPATCH_URL is not set."
exit 1
fi

if [ -z "${REF_NAME}" ]; then
echo "Error: REF_NAME is not set."
exit 1
fi

curl \
--fail \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
${GITHUB_DISPATCH_URL} \
-d '{"ref":"refs/heads/main"}'
-d "{\"ref\":\"${REF_NAME}\"}"

0 comments on commit a714c69

Please sign in to comment.