#!/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"'"}}'