Last active
October 18, 2023 15:45
-
-
Save fmount/1689befebaf78b4257574b662a944ea8 to your computer and use it in GitHub Desktop.
depends-on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
REF_REPO="glance-operator" | |
PR_NUMBER="329" | |
DEPENDS_ON=$(curl -s -X GET -H \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/openstack-k8s-operators/${REF_REPO}/pulls/${PR_NUMBER} | \ | |
jq -r '.body' | grep -iE "(depends-on).*(openstack-operator)") | |
function clone_openstack_operator { | |
git clone https://github.com/openstack-k8s-operators/openstack-operator.git | |
pushd openstack-operator | |
local pr_num="" | |
# Depends-On syntax detected in the PR description: get the PR ID | |
if [[ -n $DEPENDS_ON ]]; then | |
pr_num=$(echo "$DEPENDS_ON" | rev | cut -d"/" -f1 | rev) | |
fi | |
# make sure the PR ID we parse is a number | |
if [[ "$pr_num" == ?(-)+([0-9]) ]]; then | |
# checkout pr $pr_num | |
git fetch origin pull/"$pr_num"/head:PR"$pr_num" | |
git checkout PR"$pr_num" | |
fi | |
popd | |
} | |
clone_openstack_operator | |
pushd openstack-operator | |
make manifests && make generate && make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment