From 5979138e1119773ff3d3b24ebf6acaa6ca58975d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 5 Jul 2026 18:00:49 +0200 Subject: [PATCH 1/3] Notify author in PR size job Added a step to comment on PR if it exceeds size limits. --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0067f61..dfc3468 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + pull-requests: write env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }} @@ -96,14 +97,30 @@ jobs: fetch-depth: 0 - name: Check nr of lines changed + id: size_check run: | read ADDED REMOVED < <(git diff "$BASE" "$HEAD" --numstat -- src/ | awk '{added+=$1; removed+=$2} END {print added+0, removed+0}') echo "Lines changed in src/: +$ADDED -$REMOVED (max +/- $MAX_LINE_CHANGE_COUNT_SRC)" if [ "$ADDED" -gt $MAX_LINE_CHANGE_COUNT_SRC ] || [ "$REMOVED" -gt $MAX_LINE_CHANGE_COUNT_SRC ]; then - echo - echo "This PR is too large to review" - echo "Please split it into smaller PRs" - echo "=> See CONTRIBUTING.md for more info" - echo + echo "too_large=true" >> "$GITHUB_OUTPUT" exit 1 fi + + - name: Comment on PR + if: failure() && steps.size_check.outputs.too_large == 'true' + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const body = [ + "This PR is too large to review.", + "", + "Please split it into smaller PRs.", + "See `CONTRIBUTING.md` for more info." + ].join("\n") + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body + }) From 481be617208845e1722716494b9f501ff3dbce77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 5 Jul 2026 18:03:44 +0200 Subject: [PATCH 2/3] Clarify permissions in PR size workflow Added comment to clarify permissions for PR size check. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfc3468..8a3fdad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + # Required to post a PR comment pull-requests: write env: BASE: ${{ github.event.pull_request.base.sha }} From da414565b9882d453f3bcf7a16ff611b514b21d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 5 Jul 2026 18:12:03 +0200 Subject: [PATCH 3/3] Update PR size workflow permissions --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a3fdad..6ea964b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,8 +84,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - # Required to post a PR comment - pull-requests: write + pull-requests: write # Required to post a PR comment env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }}