Skip to content

Commit d396c4c

Browse files
committed
Limit number of cleanup PRs
currently an unlimited number of PRs are created for cleanups. Especially when enabling new cleanups this can lead to a massive amount of PRs created what are hard to manage and probably block the CI. This now enables a limit of 10 open PRs at a time.
1 parent cf05ba6 commit d396c4c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/cleanCode.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ jobs:
7878
max-parallel: 1
7979
fail-fast: false
8080
steps:
81+
- name: List number of open PRs
82+
id: list-prs
83+
run: |
84+
json_output=$(gh pr list -l 'cleanup' -R $OWNER/$REPO -L 100 --json id)
85+
echo "prs=$json_output" | tee -a "$GITHUB_OUTPUT"
86+
env:
87+
GH_TOKEN: ${{ secrets.token }}
88+
OWNER: ${{ github.repository_owner }}
89+
REPO: ${{ github.event.repository.name }}
8190
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8291
with:
8392
fetch-depth: 0
@@ -98,17 +107,17 @@ jobs:
98107
cache: maven
99108
- name: Perform Cleanups on ${{ matrix.bundles }}
100109
working-directory: ${{ matrix.bundles }}
101-
if: ${{ inputs.do-cleanups }}
110+
if: ${{ inputs.do-cleanups && fromJson(steps.list-prs.outputs.prs)[9] == null }}
102111
run: >-
103112
xvfb-run mvn -B -ntp tycho-cleancode:cleanup@cleanups
104113
- name: Perform QuickFixes on ${{ matrix.bundles }}
105114
working-directory: ${{ matrix.bundles }}
106-
if: ${{ inputs.do-quickfix }}
115+
if: ${{ inputs.do-quickfix && fromJson(steps.list-prs.outputs.prs)[9] == null }}
107116
run: >-
108117
xvfb-run mvn -B -ntp tycho-cleancode:quickfix@quickfixes
109118
- name: Create final PR description
110119
working-directory: ${{ matrix.bundles }}/target
111-
if: ${{ hashFiles(format('{0}/target/quickfix.md', matrix.bundles)) != '' }} || ${{ hashFiles(format('{0}/target/cleanups.md', matrix.bundles)) != '' }}
120+
if: ${{ hashFiles(format('{0}/target/quickfix.md', matrix.bundles)) != '' || hashFiles(format('{0}/target/cleanups.md', matrix.bundles)) != '' }}
112121
run: >-
113122
cat *.md > pr.md
114123
- name: Create Pull Request

0 commit comments

Comments
 (0)