mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-04 12:01:23 +02:00
plugin automation: fix create pr (#21518)
* plugin automation: fix create pr * get vault pr num
This commit is contained in:
parent
208336d251
commit
00295d2bf5
32
.github/scripts/plugin-helper-gh-pr-create.sh
vendored
32
.github/scripts/plugin-helper-gh-pr-create.sh
vendored
@ -1,20 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# this script expects the following env vars to be set
|
||||
# - GITHUB_TOKEN
|
||||
# - PLUGIN_REPO
|
||||
# - VAULT_BRANCH
|
||||
# - PLUGIN_BRANCH
|
||||
# - RUN_ID
|
||||
set -e
|
||||
|
||||
echo "ENVS:"
|
||||
if [ -z $GITHUB_TOKEN ]; then
|
||||
echo "github token is unset?"
|
||||
fi
|
||||
echo "$PLUGIN_REPO"
|
||||
echo "$VAULT_BRANCH"
|
||||
echo "$PLUGIN_BRANCH"
|
||||
echo "$RUN_ID"
|
||||
# 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 resluting
|
||||
# PR URL from the JSON response
|
||||
@ -31,19 +25,23 @@ resp=$(curl -SL \
|
||||
"title":"[DO NOT MERGE]: $PLUGIN_REPO Automated plugin update check",
|
||||
"body":"Updates $PLUGIN_REPO to verify vault CI. Full log: https://github.com/hashicorp/vault/actions/runs/$RUN_ID",
|
||||
"head":"$VAULT_BRANCH",
|
||||
"base":"master",
|
||||
"label": "dependencies,pr/no-changelog,pr/no-milestone",
|
||||
"base":"main",
|
||||
"reviewer": "$reviewers",
|
||||
}
|
||||
EOF
|
||||
)
|
||||
)
|
||||
|
||||
echo "captured response:"
|
||||
echo "$resp" | jq .
|
||||
|
||||
# get Vault PR number
|
||||
vault_pr_num=$(echo "$resp" | jq '.number')
|
||||
vault_pr_url=$(echo "$resp" | jq '.html_url')
|
||||
echo "$vault_pr_url"
|
||||
echo "Vault PR number: $vault_pr_url"
|
||||
|
||||
# add labels to Vault PR
|
||||
gh pr edit $vault_pr_num ---add-label "dependencies,pr/no-changelong,pr/no-milestone" --repo hashicorp/vault
|
||||
|
||||
# get Plugin PR number
|
||||
plugin_pr_num=$(gh pr list --head "$PLUGIN_BRANCH" --json number --repo hashicorp/$PLUGIN_REPO -q '.[0].number')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user