diff --git a/.changeset/pr-comment-stale-banner-via-path.md b/.changeset/pr-comment-stale-banner-via-path.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/pr-comment-stale-banner-via-path.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 28e159c706..ae42b33ad7 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -39,8 +39,11 @@ jobs: if: steps.find-comment.outputs.comment-id != '' id: get-comment uses: actions/github-script@v7 + env: + STARTED_AT: ${{ github.run_started_at }} with: script: | + const fs = require('fs'); const comment = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -49,7 +52,7 @@ jobs: // Extract the results section (everything after the header and running message) const body = comment.data.body; // Remove any existing stale warning and running message - let resultsSection = body + const resultsSection = body .replace(/\n## 📊 Benchmark Results\n\n> ⚠️ \*\*Results below are stale\*\*[^\n]*\n\n/g, '') .replace(/\n## 📊 Benchmark Results\n\n/g, '') .replace(/⏳ \*\*Benchmarks are running\.\.\.\*\*\n\n---\n_Started at:[^_]*_\n\n---\n\n/g, '') @@ -58,8 +61,25 @@ jobs: // If there's actual content left (benchmark tables), save it if (resultsSection && resultsSection.includes('|')) { + // Write the full stale-banner message to disk and pass the + // path to the sticky-pull-request-comment action below. + // Inlining the previous results via `message:` blew past + // ARG_MAX once the benchmark tables grew large enough. + const startedAt = process.env.STARTED_AT; + const message = + '\n' + + '## 📊 Benchmark Results\n\n' + + '> ⚠️ **Results below are stale** and not from the latest commit. This comment will be updated when CI completes on the latest run.\n\n' + + '⏳ **Benchmarks are running...**\n\n' + + '---\n' + + `_Started at: ${startedAt}_\n\n` + + '---\n\n' + + resultsSection + + '\n'; + const path = `${process.env.RUNNER_TEMP}/stale-comment.md`; + fs.writeFileSync(path, message); core.setOutput('has-results', 'true'); - core.setOutput('previous-results', resultsSection); + core.setOutput('stale-comment-path', path); } else { core.setOutput('has-results', 'false'); } @@ -78,27 +98,14 @@ jobs: This comment will be updated with the results when the benchmarks complete. --- - _Started at: ${{ github.event.pull_request.updated_at }}_ + _Started at: ${{ github.run_started_at }}_ - name: Update existing benchmark comment with stale warning if: steps.find-comment.outputs.comment-id != '' && steps.get-comment.outputs.has-results == 'true' uses: marocchino/sticky-pull-request-comment@v2 with: header: benchmark-results - message: | - - ## 📊 Benchmark Results - - > ⚠️ **Results below are stale** and not from the latest commit. This comment will be updated when CI completes on the latest run. - - ⏳ **Benchmarks are running...** - - --- - _Started at: ${{ github.event.pull_request.updated_at }}_ - - --- - - ${{ steps.get-comment.outputs.previous-results }} + path: ${{ steps.get-comment.outputs.stale-comment-path }} - name: Update existing benchmark comment without results if: steps.find-comment.outputs.comment-id != '' && steps.get-comment.outputs.has-results != 'true' @@ -114,7 +121,7 @@ jobs: This comment will be updated with the results when the benchmarks complete. --- - _Started at: ${{ github.event.pull_request.updated_at }}_ + _Started at: ${{ github.run_started_at }}_ # Phase 1: Build all packages (not workbenches) build: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f9be227c8d..8731837e56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,8 +38,11 @@ jobs: if: steps.find-comment.outputs.comment-id != '' id: get-comment uses: actions/github-script@v7 + env: + STARTED_AT: ${{ github.run_started_at }} with: script: | + const fs = require('fs'); const comment = await github.rest.issues.getComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -49,15 +52,32 @@ jobs: // Check if there are actual results (tables) if (body.includes('|') && body.includes('Passed')) { // Extract results section (everything after header) - let resultsSection = body + const resultsSection = body .replace(/\n## 🧪 E2E Test Results\n\n> ⚠️ \*\*Results below are stale\*\*[^\n]*\n\n/g, '') .replace(/\n## 🧪 E2E Test Results\n\n/g, '') .replace(/⏳ \*\*Tests are running\.\.\.\*\*\n\n---\n_Started at:[^_]*_\n\n---\n\n/g, '') .replace(/⏳ \*\*Tests are running\.\.\.\*\*\n\n---\n_Started at:[^_]*_/g, '') .trim(); if (resultsSection && resultsSection.includes('|')) { + // Write the full stale-banner message to disk and pass the + // path to the sticky-pull-request-comment action below. + // Inlining the previous results via `message:` blew past + // ARG_MAX once the matrix doubled (snapshot + replay). + const startedAt = process.env.STARTED_AT; + const message = + '\n' + + '## 🧪 E2E Test Results\n\n' + + '> ⚠️ **Results below are stale** and not from the latest commit. This comment will be updated when CI completes on the latest run.\n\n' + + '⏳ **Tests are running...**\n\n' + + '---\n' + + `_Started at: ${startedAt}_\n\n` + + '---\n\n' + + resultsSection + + '\n'; + const path = `${process.env.RUNNER_TEMP}/stale-comment.md`; + fs.writeFileSync(path, message); core.setOutput('has-results', 'true'); - core.setOutput('previous-results', resultsSection); + core.setOutput('stale-comment-path', path); } else { core.setOutput('has-results', 'false'); } @@ -79,27 +99,14 @@ jobs: This comment will be updated with the results when the tests complete. --- - _Started at: ${{ github.event.pull_request.updated_at }}_ + _Started at: ${{ github.run_started_at }}_ - name: Update existing test comment with stale warning if: steps.find-comment.outputs.comment-id != '' && steps.get-comment.outputs.has-results == 'true' uses: marocchino/sticky-pull-request-comment@v2 with: header: e2e-test-results - message: | - - ## 🧪 E2E Test Results - - > ⚠️ **Results below are stale** and not from the latest commit. This comment will be updated when CI completes on the latest run. - - ⏳ **Tests are running...** - - --- - _Started at: ${{ github.event.pull_request.updated_at }}_ - - --- - - ${{ steps.get-comment.outputs.previous-results }} + path: ${{ steps.get-comment.outputs.stale-comment-path }} - name: Update existing test comment without results if: steps.find-comment.outputs.comment-id != '' && steps.get-comment.outputs.has-results != 'true' @@ -115,7 +122,7 @@ jobs: This comment will be updated with the results when the tests complete. --- - _Started at: ${{ github.event.pull_request.updated_at }}_ + _Started at: ${{ github.run_started_at }}_ unit: name: Unit Tests (${{ matrix.os }})