#!/usr/bin/env bash set -e # this script expects the following env vars to be set # error if these are not set [ ${GITHUB_TOKEN:?} ] [ ${PLUGIN_REPO:?} ] [ ${VAULT_BRANCH:?} ] [ ${PLUGIN_BRANCH:?} ] [ ${RUN_ID:?} ] # we are using the GH API directly so that we can get the resulting # PR URL from the JSON response resp=$(curl -SL \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}"\ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/hashicorp/vault/pulls \ --data @<(cat <