From e5c5c3e550972d6744570ec9847798674fcd942b Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Sat, 22 Nov 2025 23:43:57 +0100 Subject: [PATCH 01/21] feat(ci): unconditionally hide prior formatting PR comments, and only post a new one in case of failure --- .github/workflows/linter.yml | 88 +++++++++++++++++++++++++----------- package.json | 3 +- 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 9dcce6dd4..7588466b1 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -10,13 +10,13 @@ on: workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }}-linter cancel-in-progress: true permissions: contents: read pull-requests: write - issues: write + # issues: write jobs: format-check: @@ -52,6 +52,7 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | + set -euo pipefail if [ -z $(echo -e "${ALL_CHANGED_FILES[@]}" | tr -d '[:space:]') ]; then echo -e '\nNo such files affected!' exit 0 @@ -61,26 +62,63 @@ jobs: echo "- $file" done echo - npx remark --no-stdout --quiet --frail --silently-ignore $(echo -e "${ALL_CHANGED_FILES[@]}" | tr '\n' ' ') - - - name: ${{ steps.check-fmt.conclusion == 'failure' && '👀 How to fix the formatting? See these suggestions!' || '...' }} - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - if: failure() - run: | - # Preparations FILES="$(echo -e "${ALL_CHANGED_FILES[@]}" | tr '\n' ' ')" - BODY="{\"body\":\"To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpx remark -o --silent --silently-ignore ${FILES}\n\`\`\`\"}" - # Comment on the PR - curl -s -o /dev/null -L -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - -d "$BODY" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments - # Comment right in the actions output - echo -e "\nInstall necessary dependencies: \033[31mnpm ci\033[0m" - echo -e "Then, run this to fix formatting: \033[31mnpx remark -o --silent --silently-ignore ${FILES}\033[0m" + ( # try + npm run check:fmt:some -- $FILES + ) || ( # catch + ERR="$(echo $?)" + # Comment right in the actions output + echo -e "\nInstall necessary dependencies: \033[31mnpm ci\033[0m" + echo -e "Then, run this to fix formatting: \033[31mnpm run fmt:some -- ${FILES}\033[0m" + # Prepare a comment on the PR + COMMENT="To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpm run fmt:some -- ${FILES}\n\`\`\`" + echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" + # Rethrow the exit code of the failed formatting check + exit $ERR + ) + + - name: Manage PR comments + if: ${{ !cancelled() }} + env: + COMMENT: ${{ env.COMMENT }} + SUCCESS: ${{ steps.check-fmt.conclusion == 'failure' && 'false' || 'true' }} + uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 + with: + script: | + const success = JSON.parse(process.env.SUCCESS ?? 'false'); + const comment_text = process.env.COMMENT ?? ''; + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + for (const comment of comments.data) { + if ( + comment.user.type === 'Bot' && + comment.user.login === 'github-actions[bot]' && + comment.body.startsWith(comment_text.slice(0, 30)) + ) { + await github.rest.graphql(` + mutation { + minimizeComment(input: { + subjectId: "${comment.node_id}", + classifier: ${success ? 'RESOLVED' : 'OUTDATED'} + }) { + clientMutationId + } + } + `); + await exec.exec('sleep 1s'); + } + } + if (!success) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `"${comment_text}"`, + }); + } spell-check: name: "Spelling" @@ -142,11 +180,9 @@ jobs: if: ${{ !cancelled() }} run: node scripts/check-redirects.mjs previous - # NOTE: Re-enable before the release, - # see: https://github.com/ton-org/docs/issues/39 - # - name: Check redirects against the upstream docs.json structure - # if: ${{ !cancelled() }} - # run: node scripts/check-redirects.mjs upstream + - name: Check redirects against the upstream docs.json structure + if: ${{ !cancelled() }} + run: node scripts/check-redirects.mjs upstream navigation-check: name: "Navigation" diff --git a/package.json b/package.json index 9978092e0..d286589ea 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,11 @@ "check:navigation": "node scripts/check-navigation.mjs", "check:fs": "echo 'https://github.com/ton-org/docs/issues/1182'", "check:fmt": "remark . -e mdx,md --no-stdout --quiet --frail", + "check:fmt:some": "remark --no-stdout --quiet --frail --silently-ignore", "check:spell": "cspell --no-progress --show-suggestions .", "check:all": "npm run check:openapi && npm run check:links && npm run check:redirects && npm run check:fs && npm run check:fmt && npm run check:spell", "fmt": "remark . -e mdx,md -o --silent", - "fmt:some": "remark -o --silent", + "fmt:some": "remark -o --silent --silently-ignore", "spell": "cspell lint --no-progress --show-suggestions .", "spell:some": "cspell lint", "lint:all": "npm run check:all", From 5f78a67612a481f633a2cdbe1595dbd27f905061 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:41:19 +0100 Subject: [PATCH 02/21] let's fail the formatter --- start-here.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/start-here.mdx b/start-here.mdx index ac87d1b0e..3d98f6fa3 100644 --- a/start-here.mdx +++ b/start-here.mdx @@ -6,6 +6,10 @@ icon: rocket import { Aside } from "/snippets/aside.jsx"; import { Image } from "/snippets/image.jsx"; + + + + The documentation is organized by layers of detail, with lower-level details appearing later. | | | From 4ff28e7c93486fa74b0d6830c8d7f4c2495fb604 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:43:20 +0100 Subject: [PATCH 03/21] 1 --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7588466b1..c7247895a 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -116,7 +116,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: `"${comment_text}"`, + body: `${comment_text.slice(1, -1)}`, }); } From 8f7fb60a4a0d51f20723531c4e9b66c48c3f53e3 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:44:58 +0100 Subject: [PATCH 04/21] 1 --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c7247895a..5facf921e 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -72,7 +72,7 @@ jobs: echo -e "Then, run this to fix formatting: \033[31mnpm run fmt:some -- ${FILES}\033[0m" # Prepare a comment on the PR COMMENT="To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpm run fmt:some -- ${FILES}\n\`\`\`" - echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" + echo -e "COMMENT='$COMMENT'" >> "$GITHUB_ENV" # Rethrow the exit code of the failed formatting check exit $ERR ) From f861ce58ba7b8818291d4e27da5a33102464e651 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 17:52:37 +0100 Subject: [PATCH 05/21] 1 --- .github/workflows/linter.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5facf921e..8cff0c8fd 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -72,7 +72,7 @@ jobs: echo -e "Then, run this to fix formatting: \033[31mnpm run fmt:some -- ${FILES}\033[0m" # Prepare a comment on the PR COMMENT="To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpm run fmt:some -- ${FILES}\n\`\`\`" - echo -e "COMMENT='$COMMENT'" >> "$GITHUB_ENV" + echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" # Rethrow the exit code of the failed formatting check exit $ERR ) @@ -105,6 +105,10 @@ jobs: classifier: ${success ? 'RESOLVED' : 'OUTDATED'} }) { clientMutationId + minimizedComment { + isMinimized + minimizedReason + } } } `); @@ -116,7 +120,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: `${comment_text.slice(1, -1)}`, + body: `${comment_text.slice(1, -1).replace(/\\n/g, '\n')}`, }); } From 793e157768b1a7338e9a269cea19a7308580510b Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:01:39 +0100 Subject: [PATCH 06/21] 1 --- .github/workflows/linter.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 8cff0c8fd..a1f1ecdf0 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -61,18 +61,19 @@ jobs: for file in ${ALL_CHANGED_FILES}; do echo "- $file" done - echo FILES="$(echo -e "${ALL_CHANGED_FILES[@]}" | tr '\n' ' ')" ( # try - npm run check:fmt:some -- $FILES + npm run check:fmt:some -- $FILES 2>&1 ) || ( # catch ERR="$(echo $?)" # Comment right in the actions output - echo -e "\nInstall necessary dependencies: \033[31mnpm ci\033[0m" - echo -e "Then, run this to fix formatting: \033[31mnpm run fmt:some -- ${FILES}\033[0m" + echo -e "\n\033[31mError:\033[0m Some files are not properly formatted!" + echo -e "To fix:" + echo -e "1. Install necessary dependencies: \033[31mnpm ci\033[0m" + echo -e "2. Run this command: \033[31mnpm run fmt:some -- ${FILES}\033[0m" # Prepare a comment on the PR COMMENT="To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpm run fmt:some -- ${FILES}\n\`\`\`" - echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" + echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" # notice the '' # Rethrow the exit code of the failed formatting check exit $ERR ) From 7db37dfe2e78d6642c250a71965efa6d5212133c Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:07:52 +0100 Subject: [PATCH 07/21] 1 --- .github/workflows/linter.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index a1f1ecdf0..c235d471f 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -63,14 +63,13 @@ jobs: done FILES="$(echo -e "${ALL_CHANGED_FILES[@]}" | tr '\n' ' ')" ( # try - npm run check:fmt:some -- $FILES 2>&1 + npm run check:fmt:some -- $FILES >/dev/null 2>&1 ) || ( # catch ERR="$(echo $?)" # Comment right in the actions output echo -e "\n\033[31mError:\033[0m Some files are not properly formatted!" - echo -e "To fix:" echo -e "1. Install necessary dependencies: \033[31mnpm ci\033[0m" - echo -e "2. Run this command: \033[31mnpm run fmt:some -- ${FILES}\033[0m" + echo -e "2. Run this command to fix the issues: \033[31mnpm run fmt:some -- ${FILES}\033[0m" # Prepare a comment on the PR COMMENT="To fix the **formatting** issues:\n\n1. Install necessary dependencies: \`npm ci\`\n2. Then, run this command:\n\`\`\`shell\nnpm run fmt:some -- ${FILES}\n\`\`\`" echo "COMMENT='$COMMENT'" >> "$GITHUB_ENV" # notice the '' @@ -95,7 +94,6 @@ jobs: }); for (const comment of comments.data) { if ( - comment.user.type === 'Bot' && comment.user.login === 'github-actions[bot]' && comment.body.startsWith(comment_text.slice(0, 30)) ) { From 93e69dc1449806692d7a853c39f29f911a0e9e9c Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:51:11 +0100 Subject: [PATCH 08/21] 1 --- .github/workflows/linter.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c235d471f..9132338bc 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -97,7 +97,7 @@ jobs: comment.user.login === 'github-actions[bot]' && comment.body.startsWith(comment_text.slice(0, 30)) ) { - await github.rest.graphql(` + const res = await github.rest.graphql(` mutation { minimizeComment(input: { subjectId: "${comment.node_id}", @@ -111,6 +111,7 @@ jobs: } } `); + console.log(res); await exec.exec('sleep 1s'); } } From f8aa841ab7aaa00ffb4b722c06040c45473c9202 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:57:15 +0100 Subject: [PATCH 09/21] 1 --- .github/workflows/linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 9132338bc..0b81a2b20 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -93,6 +93,7 @@ jobs: issue_number: context.issue.number, }); for (const comment of comments.data) { + console.log(comment); if ( comment.user.login === 'github-actions[bot]' && comment.body.startsWith(comment_text.slice(0, 30)) From f0c55bea0e5fc991bbe85a3614065bcd6c5a2192 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:06:58 +0100 Subject: [PATCH 10/21] 1 --- .github/workflows/linter.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 0b81a2b20..a35188037 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -78,7 +78,7 @@ jobs: ) - name: Manage PR comments - if: ${{ !cancelled() }} + if: ${{ !cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} env: COMMENT: ${{ env.COMMENT }} SUCCESS: ${{ steps.check-fmt.conclusion == 'failure' && 'false' || 'true' }} @@ -95,8 +95,9 @@ jobs: for (const comment of comments.data) { console.log(comment); if ( + comment. comment.user.login === 'github-actions[bot]' && - comment.body.startsWith(comment_text.slice(0, 30)) + comment.body.slice(2, -2).startsWith(comment_text.slice(1, 30)) ) { const res = await github.rest.graphql(` mutation { From 80146e89d84b800fe9a9999fe278145e70e9eb45 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:16:05 +0100 Subject: [PATCH 11/21] 1 --- .github/workflows/linter.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index a35188037..df32f71e1 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -86,18 +86,21 @@ jobs: with: script: | const success = JSON.parse(process.env.SUCCESS ?? 'false'); - const comment_text = process.env.COMMENT ?? ''; + const rawCommentText = process.env.COMMENT ?? ''; const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, }); for (const comment of comments.data) { + const cleanedBody = comment.body.slice(2, -2); + const cleanedPrefix = rawCommentText.slice(1, 30); console.log(comment); + console.log(cleanedBody); + console.log(cleanedPrefix); if ( - comment. comment.user.login === 'github-actions[bot]' && - comment.body.slice(2, -2).startsWith(comment_text.slice(1, 30)) + cleanedBody.startsWith(cleanedPrefix) ) { const res = await github.rest.graphql(` mutation { @@ -122,7 +125,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: `${comment_text.slice(1, -1).replace(/\\n/g, '\n')}`, + body: `${rawCommentText.slice(1, -1).replace(/\\n/g, '\n')}`, }); } From b30764d46c6fc51253900fcfa33ea4acc92f311e Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:19:33 +0100 Subject: [PATCH 12/21] 1 --- .github/workflows/linter.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index df32f71e1..c8773c399 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -102,7 +102,7 @@ jobs: comment.user.login === 'github-actions[bot]' && cleanedBody.startsWith(cleanedPrefix) ) { - const res = await github.rest.graphql(` + console.log(await github.graphql(` mutation { minimizeComment(input: { subjectId: "${comment.node_id}", @@ -115,8 +115,7 @@ jobs: } } } - `); - console.log(res); + `)); await exec.exec('sleep 1s'); } } From b0026567a60aa6d89b0423b1ca29779f824d21b0 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:23:21 +0100 Subject: [PATCH 13/21] 1 --- .github/workflows/linter.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c8773c399..bbeac1cbf 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -93,14 +93,13 @@ jobs: issue_number: context.issue.number, }); for (const comment of comments.data) { - const cleanedBody = comment.body.slice(2, -2); - const cleanedPrefix = rawCommentText.slice(1, 30); - console.log(comment); - console.log(cleanedBody); - console.log(cleanedPrefix); + const body = comment.body; + const prefix = rawCommentText.slice(1, 30); + console.log(`--${body}--`); + console.log(`--${prefix}--`); if ( comment.user.login === 'github-actions[bot]' && - cleanedBody.startsWith(cleanedPrefix) + body.startsWith(prefix) ) { console.log(await github.graphql(` mutation { From fcb0eecea377f7b057db0b121c1100f3d78bc734 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:30:06 +0100 Subject: [PATCH 14/21] 1 --- .github/workflows/linter.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index bbeac1cbf..e173b579a 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -87,6 +87,9 @@ jobs: script: | const success = JSON.parse(process.env.SUCCESS ?? 'false'); const rawCommentText = process.env.COMMENT ?? ''; + if (!success && rawCommentText === '') { + process.exit(0); + } const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, @@ -95,8 +98,10 @@ jobs: for (const comment of comments.data) { const body = comment.body; const prefix = rawCommentText.slice(1, 30); + console.log(comment); console.log(`--${body}--`); console.log(`--${prefix}--`); + console.log(`-------------`); if ( comment.user.login === 'github-actions[bot]' && body.startsWith(prefix) @@ -105,7 +110,7 @@ jobs: mutation { minimizeComment(input: { subjectId: "${comment.node_id}", - classifier: ${success ? 'RESOLVED' : 'OUTDATED'} + classifier: "${success ? 'RESOLVED' : 'OUTDATED'}" }) { clientMutationId minimizedComment { From fe05f7f17e14dab0ccdd35efd62dd36ebd9433ed Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:51:59 +0100 Subject: [PATCH 15/21] 1 --- .github/workflows/linter.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index e173b579a..97d9c64dd 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -96,9 +96,19 @@ jobs: issue_number: context.issue.number, }); for (const comment of comments.data) { + const minified = await github.graphql(` + query($commentId: ID!) { + node(id: $commentId) { + ... on IssueComment { + isMinimized + minimizedReason + } + } + } + `, { commentId: comment.id }); + console.log(minified); const body = comment.body; const prefix = rawCommentText.slice(1, 30); - console.log(comment); console.log(`--${body}--`); console.log(`--${prefix}--`); console.log(`-------------`); @@ -109,8 +119,8 @@ jobs: console.log(await github.graphql(` mutation { minimizeComment(input: { - subjectId: "${comment.node_id}", - classifier: "${success ? 'RESOLVED' : 'OUTDATED'}" + subjectId:$subjectId, + classifier:$classifier }) { clientMutationId minimizedComment { @@ -119,7 +129,10 @@ jobs: } } } - `)); + `, { + subjectId: comment.node_id, + classifier: success ? 'RESOLVED' : 'OUTDATED', + })); await exec.exec('sleep 1s'); } } From 316052343336ff311cbcabf1f692c103e14a3246 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 20:58:48 +0100 Subject: [PATCH 16/21] 1 --- .github/workflows/linter.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 97d9c64dd..f5292637b 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -97,15 +97,15 @@ jobs: }); for (const comment of comments.data) { const minified = await github.graphql(` - query($commentId: ID!) { - node(id: $commentId) { + query($nodeId: ID!) { + node(id: $nodeId) { ... on IssueComment { isMinimized minimizedReason } } } - `, { commentId: comment.id }); + `, { nodeId: comment.node_id }); console.log(minified); const body = comment.body; const prefix = rawCommentText.slice(1, 30); From 3db3dd52b6cfa1b2869ac63ccd0d20a993d4e1b3 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Mon, 24 Nov 2025 21:13:06 +0100 Subject: [PATCH 17/21] lookin' finger lickin' good --- .github/workflows/linter.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index f5292637b..44ba2ae27 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -77,7 +77,7 @@ jobs: exit $ERR ) - - name: Manage PR comments + - name: Hide prior PR comments and issue a new one in case of failure if: ${{ !cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} env: COMMENT: ${{ env.COMMENT }} @@ -96,31 +96,28 @@ jobs: issue_number: context.issue.number, }); for (const comment of comments.data) { - const minified = await github.graphql(` + const isHidden = (await github.graphql(` query($nodeId: ID!) { node(id: $nodeId) { ... on IssueComment { isMinimized - minimizedReason } } } - `, { nodeId: comment.node_id }); - console.log(minified); + `, { nodeId: comment.node_id }))?.node?.isMinimized; + await exec.exec('sleep 0.5s'); + if (isHidden) { continue; } const body = comment.body; const prefix = rawCommentText.slice(1, 30); - console.log(`--${body}--`); - console.log(`--${prefix}--`); - console.log(`-------------`); if ( comment.user.login === 'github-actions[bot]' && body.startsWith(prefix) ) { console.log(await github.graphql(` - mutation { + mutation($subjectId: ID!, $classifier: ReportedContentClassifiers!) { minimizeComment(input: { - subjectId:$subjectId, - classifier:$classifier + subjectId: $subjectId, + classifier: $classifier }) { clientMutationId minimizedComment { @@ -133,7 +130,7 @@ jobs: subjectId: comment.node_id, classifier: success ? 'RESOLVED' : 'OUTDATED', })); - await exec.exec('sleep 1s'); + await exec.exec('sleep 0.5s'); } } if (!success) { From 2c47997bdbb50a4dbf6ffab80481edd4e314384f Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 25 Nov 2025 00:09:23 +0100 Subject: [PATCH 18/21] and now reverting the formatting back --- .github/workflows/linter.yml | 2 +- start-here.mdx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 44ba2ae27..a4b23f2a3 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -113,13 +113,13 @@ jobs: comment.user.login === 'github-actions[bot]' && body.startsWith(prefix) ) { + console.log('Comment node_id:', comment.node_id); console.log(await github.graphql(` mutation($subjectId: ID!, $classifier: ReportedContentClassifiers!) { minimizeComment(input: { subjectId: $subjectId, classifier: $classifier }) { - clientMutationId minimizedComment { isMinimized minimizedReason diff --git a/start-here.mdx b/start-here.mdx index 3d98f6fa3..ac87d1b0e 100644 --- a/start-here.mdx +++ b/start-here.mdx @@ -6,10 +6,6 @@ icon: rocket import { Aside } from "/snippets/aside.jsx"; import { Image } from "/snippets/image.jsx"; - - - - The documentation is organized by layers of detail, with lower-level details appearing later. | | | From 9adbb829c7f2e797473894f82d4033d56a637aec Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 25 Nov 2025 20:45:54 +0100 Subject: [PATCH 19/21] try { place the CI script outside of yaml file } catch (err) { throw err } --- .../manage-pr-comments-after-check.mjs | 58 ++++++++++++++++++ .github/workflows/linter.yml | 60 +------------------ 2 files changed, 61 insertions(+), 57 deletions(-) create mode 100644 .github/scripts/manage-pr-comments-after-check.mjs diff --git a/.github/scripts/manage-pr-comments-after-check.mjs b/.github/scripts/manage-pr-comments-after-check.mjs new file mode 100644 index 000000000..2835191c0 --- /dev/null +++ b/.github/scripts/manage-pr-comments-after-check.mjs @@ -0,0 +1,58 @@ +export default async function({ github, context, exec }) { + const success = JSON.parse(process.env.SUCCESS ?? 'false'); + const rawCommentText = process.env.COMMENT ?? ''; + if (!success && rawCommentText === '') { + process.exit(0); + } + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + for (const comment of comments.data) { + const isHidden = (await github.graphql(` + query($nodeId: ID!) { + node(id: $nodeId) { + ... on IssueComment { + isMinimized + } + } + } + `, { nodeId: comment.node_id }))?.node?.isMinimized; + await exec.exec('sleep 0.5s'); + if (isHidden) { continue; } + const body = comment.body; + const prefix = rawCommentText.slice(1, 30); + if ( + comment.user.login === 'github-actions[bot]' && + body.startsWith(prefix) + ) { + console.log('Comment node_id:', comment.node_id); + console.log(await github.graphql(` + mutation($subjectId: ID!, $classifier: ReportedContentClassifiers!) { + minimizeComment(input: { + subjectId: $subjectId, + classifier: $classifier + }) { + minimizedComment { + isMinimized + minimizedReason + } + } + } + `, { + subjectId: comment.node_id, + classifier: success ? 'RESOLVED' : 'OUTDATED', + })); + await exec.exec('sleep 0.5s'); + } + } + if (!success) { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `${rawCommentText.slice(1, -1).replace(/\\n/g, '\n')}`, + }); + } +} diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index db612145d..7e36f6d9f 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -78,69 +78,15 @@ jobs: ) - name: Hide prior PR comments and issue a new one in case of failure - if: ${{ !cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} + if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event_name != 'pull_request_target' }} env: COMMENT: ${{ env.COMMENT }} SUCCESS: ${{ steps.check-fmt.conclusion == 'failure' && 'false' || 'true' }} uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: script: | - const success = JSON.parse(process.env.SUCCESS ?? 'false'); - const rawCommentText = process.env.COMMENT ?? ''; - if (!success && rawCommentText === '') { - process.exit(0); - } - const comments = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - for (const comment of comments.data) { - const isHidden = (await github.graphql(` - query($nodeId: ID!) { - node(id: $nodeId) { - ... on IssueComment { - isMinimized - } - } - } - `, { nodeId: comment.node_id }))?.node?.isMinimized; - await exec.exec('sleep 0.5s'); - if (isHidden) { continue; } - const body = comment.body; - const prefix = rawCommentText.slice(1, 30); - if ( - comment.user.login === 'github-actions[bot]' && - body.startsWith(prefix) - ) { - console.log('Comment node_id:', comment.node_id); - console.log(await github.graphql(` - mutation($subjectId: ID!, $classifier: ReportedContentClassifiers!) { - minimizeComment(input: { - subjectId: $subjectId, - classifier: $classifier - }) { - minimizedComment { - isMinimized - minimizedReason - } - } - } - `, { - subjectId: comment.node_id, - classifier: success ? 'RESOLVED' : 'OUTDATED', - })); - await exec.exec('sleep 0.5s'); - } - } - if (!success) { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: `${rawCommentText.slice(1, -1).replace(/\\n/g, '\n')}`, - }); - } + const script = await import('${{ github.workspace }}/.github/scripts/manage-pr-comments-after-check.mjs'); + await script({github, context, exec}); spell-check: name: "Spelling" From 114479dd92921a4434e14cbe0a83f733091c9306 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 25 Nov 2025 21:14:13 +0100 Subject: [PATCH 20/21] let's break it, temporarily --- .github/workflows/linter.yml | 2 +- start-here.mdx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7e36f6d9f..7e0f83149 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -85,7 +85,7 @@ jobs: uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 with: script: | - const script = await import('${{ github.workspace }}/.github/scripts/manage-pr-comments-after-check.mjs'); + const { default: script } = await import('${{ github.workspace }}/.github/scripts/manage-pr-comments-after-check.mjs'); await script({github, context, exec}); spell-check: diff --git a/start-here.mdx b/start-here.mdx index ac87d1b0e..46e75e285 100644 --- a/start-here.mdx +++ b/start-here.mdx @@ -174,3 +174,6 @@ Not all computation has to be done _on-chain_, i.e., executed inside TVM and pai An [explorer](/ecosystem/explorers/overview) is a type of web app that displays information about the current state of accounts (including wallets, Jettons, and NFTs) and the history of transactions. Many popular contract types have been standardized in [TON Enhancement Proposals](https://github.com/ton-blockchain/TEPs) (_TEP_), mostly describing expected contract interfaces with TL-B schemas. This allows tooling to be reused between similar contracts. For example, explorers detect TEP-standardized contracts and display their binary messages in a user-friendly format, and provide an interface to call their get methods. + + + From 5667d570676731d3b7a1053c4ae1d2eff210b4bf Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 25 Nov 2025 21:17:07 +0100 Subject: [PATCH 21/21] =?UTF-8?q?here=20comes=20the=20fix=20=E2=80=94=20co?= =?UTF-8?q?mments,=20begone!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start-here.mdx | 3 --- 1 file changed, 3 deletions(-) diff --git a/start-here.mdx b/start-here.mdx index 46e75e285..ac87d1b0e 100644 --- a/start-here.mdx +++ b/start-here.mdx @@ -174,6 +174,3 @@ Not all computation has to be done _on-chain_, i.e., executed inside TVM and pai An [explorer](/ecosystem/explorers/overview) is a type of web app that displays information about the current state of accounts (including wallets, Jettons, and NFTs) and the history of transactions. Many popular contract types have been standardized in [TON Enhancement Proposals](https://github.com/ton-blockchain/TEPs) (_TEP_), mostly describing expected contract interfaces with TL-B schemas. This allows tooling to be reused between similar contracts. For example, explorers detect TEP-standardized contracts and display their binary messages in a user-friendly format, and provide an interface to call their get methods. - - -