From c1bdb57050ef77f1e2b293a6ff64fbc7f47893fd Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:12:18 +0100 Subject: [PATCH 1/4] chore(ci): decrease the amount of scripting in `bouncer.yml` and stop posting messages on new pushes --- .github/workflows/bouncer.yml | 95 +++++++++-------------------------- package-lock.json | 11 ++++ 2 files changed, 35 insertions(+), 71 deletions(-) diff --git a/.github/workflows/bouncer.yml b/.github/workflows/bouncer.yml index 3211459de..ef2144cab 100644 --- a/.github/workflows/bouncer.yml +++ b/.github/workflows/bouncer.yml @@ -5,11 +5,9 @@ env: # additions only MAX_ADDITIONS_FORKS: 500 # on rare occasions maintainers need to edit a lot of things at once - MAX_ADDITIONS_DIRECT_BRANCHES: 800 + MAX_ADDITIONS_DIRECT_BRANCHES: 1000 # many target issues usually mean bigger pull requests MAX_ISSUES_PER_PR: 3 - # the name of this workflow file wrapped in backticks - MSG_PREFIX: "`bouncer.yml`" on: pull_request_target: # do NOT use actions/checkout! @@ -49,61 +47,18 @@ jobs: with: script: core.exportVariable('MAX_ADDITIONS', '${{ env.MAX_ADDITIONS_DIRECT_BRANCHES }}') - - name: Remove prior comments by their common prefix - if: github.event.action == 'synchronize' - uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 - with: - # This JavaScript code cannot be moved to a separate file because - # this workflow must NOT checkout the repository for security reasons - # - # The same note applies to all JS code in this file - script: | - await exec.exec('sleep 0.5s'); - const comments = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - }); - for (const comment of comments.data) { - await exec.exec('sleep 0.5s'); - const isHidden = (await github.graphql(` - query($nodeId: ID!) { - node(id: $nodeId) { - ... on IssueComment { - isMinimized - } - } - } - `, { nodeId: comment.node_id }))?.node?.isMinimized; - if (isHidden) { continue; } - if ( - comment.user.login === 'github-actions[bot]' && - comment.body.startsWith('${{ env.MSG_PREFIX }}') - ) { - console.log('Comment node_id:', comment.node_id); - await exec.exec('sleep 0.5s'); - console.log(await github.graphql(` - mutation($subjectId: ID!) { - minimizeComment(input: { - subjectId: $subjectId, - classifier: OUTDATED - }) { - minimizedComment { - isMinimized - minimizedReason - } - } - } - `, { - subjectId: comment.node_id, - })); - } - } - - name: Check if a number of additions modulo filtered files is within the threshold id: stats uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: + # NOTE(novusnota): + # Small JavaScript chunks of code cannot be moved to a separate file because + # this workflow must NOT checkout the repository for security reasons. + # The same note applies to all JS code in this file. + # + # Personally, any code here is indistinguishable from Bash, + # but in the sense that if there were an `actions/github-script` for Haskell, + # I'd write it here nonetheless, due to potential hazards allowed by pull_request_target. script: | const maxAdditions = Number(process.env.MAX_ADDITIONS ?? '500'); await exec.exec('sleep 0.5s'); @@ -123,7 +78,6 @@ jobs: 'tvm/instructions.mdx', ].includes(f.filename) && !f.filename.endsWith('.py'), ); - // NOTE: consider looking for .changes const additions = filtered.reduce((acc, it) => acc + it.additions, 0); if (additions > maxAdditions) { core.setOutput('trigger', 'true'); @@ -142,7 +96,6 @@ jobs: repo: context.repo.repo, issue_number: context.payload.pull_request.number, body: [ - '${{ env.MSG_PREFIX }}', 'Thank you for the contribution!', [ 'Unfortunately, it is too large, with over ${{ env.MAX_ADDITIONS }} added lines,', @@ -154,7 +107,10 @@ jobs: 'reverting any unrelated changes, writing less, or approaching', 'the problem in the issue from a different angle.', ].join(' '), - 'I look forward to your next submissions. If you still intend to proceed as is, then you are at the mercy of the reviewers.', + [ + 'I look forward to your next submissions.', + 'If you still intend to proceed as is, then you are at the mercy of the reviewers.', + ].join(' '), ].join('\n\n'), }); process.exit(1); @@ -164,20 +120,17 @@ jobs: uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: script: | - await exec.exec('sleep 0.5s'); - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - body: [ - '${{ env.MSG_PREFIX }}', - [ - 'The most recent commit has made this PR go over ${{ env.MAX_ADDITIONS }} added lines.', - 'Please, decrease the size of this pull request or consider splitting it into several smaller requests.' - ].join(' '), - 'Until then, the CI will be marked as failed.', - ].join('\n\n'), - }); + core.setFailed([ + [ + 'This pull request has gotten over ${{ env.MAX_ADDITIONS }} added lines,', + 'which can be challenging to review and iterate on', + 'Please, decrease the size of this PR or consider splitting it into several smaller requests.' + ].join(' '), + [ + 'Until then, the CI will be soft-marked as failed.', + 'If you still intend to proceed as is, then you are at the mercy of the reviewers.', + ].join(' '), + ].join('\n\n')); process.exit(1); enforce-better-descriptions: diff --git a/package-lock.json b/package-lock.json index 1a37f651a..92428fe43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1498,6 +1498,17 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/@mintlify/cli/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@mintlify/common": { "version": "1.0.619", "resolved": "https://registry.npmjs.org/@mintlify/common/-/common-1.0.619.tgz", From 6b1b7da0d9f3970f6567a20bb8d2e2c8c65b56c0 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:21:11 +0100 Subject: [PATCH 2/4] 1 --- .github/workflows/bouncer.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/bouncer.yml b/.github/workflows/bouncer.yml index ef2144cab..c6e3831d6 100644 --- a/.github/workflows/bouncer.yml +++ b/.github/workflows/bouncer.yml @@ -51,14 +51,6 @@ jobs: id: stats uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: - # NOTE(novusnota): - # Small JavaScript chunks of code cannot be moved to a separate file because - # this workflow must NOT checkout the repository for security reasons. - # The same note applies to all JS code in this file. - # - # Personally, any code here is indistinguishable from Bash, - # but in the sense that if there were an `actions/github-script` for Haskell, - # I'd write it here nonetheless, due to potential hazards allowed by pull_request_target. script: | const maxAdditions = Number(process.env.MAX_ADDITIONS ?? '500'); await exec.exec('sleep 0.5s'); From 79328b5c2dd7a2c36c7118b9a1e0be2e5a636474 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:29:38 +0100 Subject: [PATCH 3/4] 1 --- .github/workflows/bouncer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bouncer.yml b/.github/workflows/bouncer.yml index c6e3831d6..074acdbf9 100644 --- a/.github/workflows/bouncer.yml +++ b/.github/workflows/bouncer.yml @@ -68,7 +68,7 @@ jobs: 'ecosystem/api/toncenter/v3.yaml', 'ecosystem/api/toncenter/smc-index.json', 'tvm/instructions.mdx', - ].includes(f.filename) && !f.filename.endsWith('.py'), + ].includes(f.filename) && !f.filename.endsWith('.py') && !f.filename.startsWith('snippets'), ); const additions = filtered.reduce((acc, it) => acc + it.additions, 0); if (additions > maxAdditions) { From 870849628b9c78dc5b7f90dd5df439c0daea828f Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Wed, 3 Dec 2025 09:43:31 +0100 Subject: [PATCH 4/4] 1 --- .github/workflows/bouncer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bouncer.yml b/.github/workflows/bouncer.yml index 074acdbf9..22a0ebed4 100644 --- a/.github/workflows/bouncer.yml +++ b/.github/workflows/bouncer.yml @@ -127,7 +127,6 @@ jobs: enforce-better-descriptions: name: "Title and description" - if: github.event.action == 'opened' || github.event.action == 'edited' runs-on: ubuntu-latest steps: # pr title check @@ -137,7 +136,8 @@ jobs: with: script: | const title = context.payload.pull_request.title; - const pattern = /^(revert: )?(feat|fix|chore|refactor|test)(?:\/(feat|fix|chore|refactor|test))?!?(\(.+?\))?!?: [a-z].{1,200}/; + const types = 'feat|fix|chore|refactor|test'; + const pattern = new RegExp(`^(revert: )?(${types})(?:\\/(${types}))?!?(\\([^\\)]+\\))?!?: [a-zA-Z].{1,200}`); const matches = title.match(pattern) !== null; if (!matches) { core.setFailed([