Skip to content

Commit

Permalink
Fix: Changing scripts to use gh instead of hub for Che #22646 (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
SDawley authored Nov 9, 2023
1 parent a4e19ea commit b787d7b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/release-che-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release-chectl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release-community-operator-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/release/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
13 changes: 5 additions & 8 deletions build/scripts/release/prepare-community-operators-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit b787d7b

Please sign in to comment.