Fix: Changing scripts to use gh instead of hub for Che #22646 (#1776)

pull/1779/head
Samantha Dawley 2023-11-09 07:25:07 -05:00 committed by GitHub
parent a4e19ead9d
commit b787d7b22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 19 deletions

View File

@ -40,8 +40,7 @@ jobs:
- name: Set up environment
run: |
sudo apt-get update -y || true
sudo apt-get -y -q install curl bash git hub
hub --version
sudo apt-get -y -q install curl bash git
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:

View File

@ -40,8 +40,7 @@ jobs:
- name: Set up environment
run: |
sudo apt-get update -y || true
sudo apt-get -y -q install curl bash git hub
hub --version
sudo apt-get -y -q install curl bash git
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:

View File

@ -36,8 +36,7 @@ jobs:
- name: Set up environment
run: |
sudo apt-get update -y || true
sudo apt-get -y -q install curl bash git hub
hub --version
sudo apt-get -y -q install curl bash git
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:

View File

@ -54,13 +54,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install operator courier, yq, hub and base32 wrapper
- name: Install operator courier, yq and base32 wrapper
run: |
python -m pip install --upgrade pip
pip install yq
pip install semver
sudo apt-get -y -q install hub
hub --version
sudo apt-get -y -q install
# get base32 util from che-release project
wget https://raw.githubusercontent.com/eclipse/che-release/master/utils/base32
# copy base32 python-based helper script into dir that's accessed from PATH (so it's accessible to this and other called scripts)

View File

@ -255,7 +255,7 @@ pushGitChanges() {
createPRToXBranch() {
echo "[INFO] createPRToXBranch :: Create pull request into ${BRANCH} branch"
if [[ $FORCE_UPDATE == "--force" ]]; then set +e; fi # don't fail if PR already exists (just force push commits into it)
hub pull-request $FORCE_UPDATE --base ${BRANCH} --head ${RELEASE_BRANCH} -m "ci: Release version ${RELEASE}"
gh pr create -f -B ${BRANCH} -H ${RELEASE_BRANCH}
set -e
}
@ -271,7 +271,7 @@ createPRToMainBranch() {
fi
git push origin $tmpBranch -f
if [[ $FORCE_UPDATE == "--force" ]]; then set +e; fi # don't fail if PR already exists (just force push commits into it)
hub pull-request $FORCE_UPDATE --base main --head ${tmpBranch} -m "ci: Copy "$RELEASE" csv to main"
gh pr create -f -B main -H ${tmpBranch}
set -e
}

View File

@ -132,19 +132,16 @@ do
echo
template_file="https://raw.githubusercontent.com/redhat-openshift-ecosystem/community-operators-prod/${base_branch}/docs/pull_request_template.md"
HUB=$(command -v hub 2>/dev/null)
GH=$(command -v gh 2>/dev/null)
upstream_org="redhat-openshift-ecosystem"
if [[ $HUB ]] && [[ -x $HUB ]]; then
echo " - Use $HUB to generate PR from template: ${template_file}"
if [[ $GH ]] && [[ -x $GH ]]; then
echo " - Use $GH to generate PR from template: ${template_file}"
PRbody=$(curl -sSLo - ${template_file} | \
sed -r -n '/#+ Updates to existing Operators/,$p' | sed -r -e "s#\[\ \]#[x]#g")
lastCommitComment="$(git log -1 --pretty=%B)"
$HUB pull-request -f -m "${lastCommitComment}
${PRbody}" -b "${upstream_org}:${base_branch}" -h "${fork_org}:${branch}"
$GH pr create -b "${PRbody}" -B "${upstream_org}:${base_branch}" -H "${fork_org}:${branch}"
else
echo "hub is not installed. Install it from https://hub.github.com/ or submit PR manually using PR template:
echo "gh is not installed. Install it from https://hub.github.com/ or submit PR manually using PR template:
${template_file}
${GIT_REMOTE_FORK_CLEAN}/pull/new/${branch}