Release - Check for unmerged PRs #14
This file contains 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
# This Workflow announces a release in Eclipse Mattermost to https://mattermost.eclipse.org/eclipse/channels/eclipse-che-releases | |
name: Release - Check for unmerged PRs | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version being released. Should be in format 7.y' | |
required: true | |
default: '' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: install yq jq | |
run: | | |
python -m ensurepip --upgrade; pip install yq jq | |
- name: Check for unmerged PRs | |
id: check | |
run: | | |
curl -sSLkO https://raw.githubusercontent.com/eclipse/che/main/.repositories.yaml | |
releaseVersionString="" | |
if [[ ${{ github.event.inputs.version }} != "" ]]; then | |
VER_Y="${{ github.event.inputs.version }}" | |
[[ $VER_Y =~ ^([0-9]+)\.([0-9]+) ]] && VER_X=${BASH_REMATCH[1]}; NEXT=${BASH_REMATCH[2]}; (( NEXT=NEXT+1 )) # for BRANCH=7.74, get BASE=7, NEXT=75 | |
versionNext="${VER_X}.${NEXT}" | |
releaseVersionString="|${{ github.event.inputs.version }}|${versionNext}" | |
fi | |
grepString="chore: Bump to |release${releaseVersionString}" | |
echo "Searching for open pull requests that match '$grepString' ..." | |
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 "$grepString" || true) | |
if [[ $PRs ]]; then | |
echo "$PRs" | |
(( 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 ... | |
PRs=$(gh api repos/${d}/pulls?state=open --jq '.[]|select(.title|contains("operator eclipse-che"))|(.html_url+"\t"+.title)') | |
if [[ $PRs ]]; then | |
echo "$PRs" | |
(( foundPRs = foundPRs + 1 )) | |
fi | |
echo; echo "Found $foundPRs open pull requests!"; exit $foundPRs |