-
Notifications
You must be signed in to change notification settings - Fork 15
60 lines (57 loc) · 2.43 KB
/
release-check-unmerged-PRs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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