Skip to content

Commit

Permalink
return cound of unmerged PRs and fail the job if >0 found
Browse files Browse the repository at this point in the history
Change-Id: Icf19c3f1ff3c9bd855f2636f7d47cd9612d8e1c9
Signed-off-by: Nick Boldt <[email protected]>
  • Loading branch information
nickboldt committed Sep 11, 2023
1 parent 1301c58 commit 71df9e6
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/release-check-unmerged-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,25 @@ jobs:
curl -sSLkO https://raw.githubusercontent.com/eclipse/che/main/.repositories.yaml
releaseVersions="${{ github.event.inputs.version }}|${{ github.event.inputs.versionNext }}"
for d in $(yq -r '.[][]|select(.useCheReleaseLifecycle==true)|.url' .repositories.yaml | sed -r -e "s#https://github.com/##" -e "s#/\$##"); do \
echo; echo $d; \
gh api repos/${d}/pulls?state=open --jq '.[]|(.html_url + "\t" + .title)' | grep -E "chore: Bump to |release|$releaseVersions" || true; \
foundPRs=0
for d in $(yq -r '.[][]|select(.useCheReleaseLifecycle==true)|.url' .repositories.yaml | sed -r -e "s#https://github.com/##" -e "s#/\$##"); do
PRs=""
echo; echo $d
PRs=$(gh api repos/${d}/pulls?state=open --jq '.[]|(.html_url + "\t" + .title)' | grep -E "chore: Bump to |release|$releaseVersions" || true)
echo "$PRs"
if [[ $PRs ]]; then
(( foundPRs = foundPRs + 1 ))
fi
done
# check unmerged community-operators-prod PRs for che-operator
d="redhat-openshift-ecosystem/community-operators-prod"
echo; echo $d; \
# search for more with: gh api repos/${d}/pulls?state=open\&sort=updated\&direction=desc\&per_page=100 ...
gh api repos/${d}/pulls?state=open --jq '.[]|select(.title|contains("operator eclipse-che"))|(.html_url+"\t"+.title)'
PRs=$(gh api repos/${d}/pulls?state=open --jq '.[]|select(.title|contains("operator eclipse-che"))|(.html_url+"\t"+.title)')
echo "$PRs"
if [[ $PRs ]]; then
(( foundPRs = foundPRs + 1 ))
fi
echo; echo "Found $foundPRs open pull requests!"; exit $foundPRs

0 comments on commit 71df9e6

Please sign in to comment.