mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #97697 from cblecker/cpp-gh
Use gh tool instead of hub for cherry pick script
This commit is contained in:
commit
f43f95aa78
@ -44,8 +44,8 @@ if [[ -z ${GITHUB_USER:-} ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! which hub > /dev/null; then
|
if ! command -v gh > /dev/null; then
|
||||||
echo "Can't find 'hub' tool in PATH, please install from https://github.com/github/hub"
|
echo "Can't find 'gh' tool in PATH, please install from https://github.com/cli/cli"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -71,6 +71,9 @@ if [[ "$#" -lt 2 ]]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Checks if you are logged in. Will error/bail if you are not.
|
||||||
|
gh auth status
|
||||||
|
|
||||||
if git_status=$(git status --porcelain --untracked=no 2>/dev/null) && [[ -n "${git_status}" ]]; then
|
if git_status=$(git status --porcelain --untracked=no 2>/dev/null) && [[ -n "${git_status}" ]]; then
|
||||||
echo "!!! Dirty tree. Clean up and try again."
|
echo "!!! Dirty tree. Clean up and try again."
|
||||||
exit 1
|
exit 1
|
||||||
@ -109,7 +112,6 @@ declare -r NEWBRANCHUNIQ
|
|||||||
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
|
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
|
||||||
|
|
||||||
cleanbranch=""
|
cleanbranch=""
|
||||||
prtext=""
|
|
||||||
gitamcleanup=false
|
gitamcleanup=false
|
||||||
function return_to_kansas {
|
function return_to_kansas {
|
||||||
if [[ "${gitamcleanup}" == "true" ]]; then
|
if [[ "${gitamcleanup}" == "true" ]]; then
|
||||||
@ -126,9 +128,6 @@ function return_to_kansas {
|
|||||||
if [[ -n "${cleanbranch}" ]]; then
|
if [[ -n "${cleanbranch}" ]]; then
|
||||||
git branch -D "${cleanbranch}" >/dev/null 2>&1 || true
|
git branch -D "${cleanbranch}" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
if [[ -n "${prtext}" ]]; then
|
|
||||||
rm "${prtext}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
trap return_to_kansas EXIT
|
trap return_to_kansas EXIT
|
||||||
@ -140,24 +139,18 @@ function make-a-pr() {
|
|||||||
echo
|
echo
|
||||||
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
|
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
|
||||||
|
|
||||||
# This looks like an unnecessary use of a tmpfile, but it avoids
|
|
||||||
# https://github.com/github/hub/issues/976 Otherwise stdin is stolen
|
|
||||||
# when we shove the heredoc at hub directly, tickling the ioctl
|
|
||||||
# crash.
|
|
||||||
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
|
|
||||||
local numandtitle
|
local numandtitle
|
||||||
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
|
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
|
||||||
cat >"${prtext}" <<EOF
|
prtext=$(cat <<EOF
|
||||||
Automated cherry pick of ${numandtitle}
|
|
||||||
|
|
||||||
Cherry pick of ${PULLSUBJ} on ${rel}.
|
Cherry pick of ${PULLSUBJ} on ${rel}.
|
||||||
|
|
||||||
${numandtitle}
|
${numandtitle}
|
||||||
|
|
||||||
For details on the cherry pick process, see the [cherry pick requests](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md) page.
|
For details on the cherry pick process, see the [cherry pick requests](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md) page.
|
||||||
EOF
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "${MAIN_REPO_ORG}:${rel}"
|
gh pr create --title="Automated cherry pick of ${numandtitle}" --body="${prtext}" --head "${GITHUB_USER}:${NEWBRANCH}" --base "${rel}" --repo="${MAIN_REPO_ORG}/${MAIN_REPO_NAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
|
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
|
||||||
|
Loading…
Reference in New Issue
Block a user