1
0
mirror of https://github.com/rancher/rke.git synced 2025-06-23 22:17:11 +00:00
rke/scripts/dispatch
2022-09-13 15:32:56 +02:00

26 lines
772 B
Bash
Executable File

#!/bin/bash
set -e
set -x
REPO="https://api.github.com/repos/rancher/rancher/actions/workflows/go-get.yml/dispatches"
case $DRONE_TAG in
"v1.4"*)
ACTION_TARGET_BRANCH="release/v2.7"
;;
*)
echo "Not a valid tag, not dispatching event"
exit 0
esac
echo "DRONE_TAG: $DRONE_TAG"
echo "DRONE_COMMIT_AUTHOR: $DRONE_COMMIT_AUTHOR"
echo "Dispatching to branch ${ACTION_TARGET_BRANCH}"
# send dispatch event to workflow
curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" $REPO \
--data '{"ref": "'"$ACTION_TARGET_BRANCH"'","inputs":{"goget_module":"github.com/rancher/rke","goget_version":"'"$DRONE_TAG"'","source_author":"'"$DRONE_COMMIT_AUTHOR"'"}}'