diff --git a/.github/workflows/lintcheck_summary.yml b/.github/workflows/lintcheck_summary.yml index 52f52e155a07..32a9f0dc8847 100644 --- a/.github/workflows/lintcheck_summary.yml +++ b/.github/workflows/lintcheck_summary.yml @@ -24,7 +24,8 @@ permissions: jobs: download: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} + # FIXME(feature freeze): Make sure to remove that last part after the feature freeze is over + if: ${{ github.event.workflow_run.conclusion == 'success' && ! contains(github.event.pull_request.labels.*.name, 'A-new-lint') }} steps: - name: Download artifact uses: actions/download-artifact@v4 @@ -40,17 +41,17 @@ jobs: script: | const fs = require("fs"); const assert = require("assert/strict"); - + function validateName(s) { assert.match(s, /^[a-z0-9_:]+$/); return s; } - + function validateInt(i) { assert.ok(Number.isInteger(i)); return i; } - + function tryReadSummary() { try { return JSON.parse(fs.readFileSync("untrusted/summary.json")); @@ -58,36 +59,36 @@ jobs: return null; } } - + const prNumber = parseInt(fs.readFileSync("untrusted/pr.txt"), 10); core.exportVariable("PR", prNumber.toString()); - + const untrustedSummary = tryReadSummary(); if (!Array.isArray(untrustedSummary)) { return; } - + let summary = `Lintcheck changes for ${context.payload.workflow_run.head_sha} | Lint | Added | Removed | Changed | | ---- | ----: | ------: | ------: | `; - + for (const untrustedRow of untrustedSummary) { const name = validateName(untrustedRow.name); - + const added = validateInt(untrustedRow.added); const removed = validateInt(untrustedRow.removed); const changed = validateInt(untrustedRow.changed); const id = name.replace("clippy::", "user-content-").replaceAll("_", "-"); const url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${context.payload.workflow_run.id}#${id}`; - + summary += `| [\`${name}\`](${url}) | ${added} | ${removed} | ${changed} |\n`; } - + summary += "\nThis comment will be updated if you push new changes"; - + fs.writeFileSync("summary.md", summary); - name: Create/update comment