From eb64c74c86d301905023f8a8de7e7f3a4def1951 Mon Sep 17 00:00:00 2001 From: 9aoy Date: Mon, 30 Dec 2024 14:16:24 +0800 Subject: [PATCH] ci: remove update-comment action (#66) * ci: remove update-comment action --- .../workflows/ecosystem-ci-from-commit.yml | 54 ------------- .github/workflows/ecosystem-ci-from-pr.yml | 77 ------------------- 2 files changed, 131 deletions(-) diff --git a/.github/workflows/ecosystem-ci-from-commit.yml b/.github/workflows/ecosystem-ci-from-commit.yml index 1467ea8..b937a2a 100644 --- a/.github/workflows/ecosystem-ci-from-commit.yml +++ b/.github/workflows/ecosystem-ci-from-commit.yml @@ -125,57 +125,3 @@ jobs: pnpm tsx ecosystem-ci.ts run-suites ${{ matrix.suite }} - - update-comment: - runs-on: ubuntu-latest - needs: [execute-selected-suite, execute-all] - if: always() - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }} - script: | - const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.runId, - per_page: 100 - }); - - const selectedSuite = context.payload.inputs.suite - let result - if (selectedSuite !== "-") { - const { conclusion, html_url } = jobs.find(job => job.name === "execute-selected-suite") - result = [{ suite: `${selectedSuite} ${context.payload.inputs.suiteRefType} ${context.payload.inputs.suiteRef}`, conclusion, link: html_url }] - } else { - result = jobs - .filter(job => job.name.startsWith('execute-all ')) - .map(job => { - const suite = job.name.replace(/^execute-all \(([^)]+)\)$/, "$1") - return { suite, conclusion: job.conclusion, link: job.html_url } - }) - } - - const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` - const urlLink = `[Open](${url})` - - const conclusionEmoji = { - success: ":white_check_mark:", - failure: ":x:", - cancelled: ":stop_button:" - } - - const body = ` - 📝 Ran ecosystem CI: ${urlLink} - - | suite | result | - |-------|--------| - ${result.map(r => `| [${r.suite}](${r.link}) | ${conclusionEmoji[r.conclusion]} ${r.conclusion} |`).join("\n")} - ` - - await github.rest.repos.createCommitComment({ - commit_sha: context.payload.inputs.commitSHA, - owner: 'web-infra-dev', - repo: 'rspack', - body - }) diff --git a/.github/workflows/ecosystem-ci-from-pr.yml b/.github/workflows/ecosystem-ci-from-pr.yml index adc15d2..6cfe184 100644 --- a/.github/workflows/ecosystem-ci-from-pr.yml +++ b/.github/workflows/ecosystem-ci-from-pr.yml @@ -53,31 +53,8 @@ on: default: "precoded" jobs: - create-comment: - runs-on: ubuntu-latest - outputs: - comment-id: ${{ steps.create-comment.outputs.result }} - steps: - - id: create-comment - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }} - result-encoding: string - script: | - const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` - const urlLink = `[Open](${url})` - - const { data: comment } = await github.rest.issues.createComment({ - issue_number: context.payload.inputs.prNumber, - owner: 'web-infra-dev', - repo: 'rspack', - body: `⏳ Triggered ecosystem CI: ${urlLink}` - }) - return comment.id - get-runner-labels: name: Get Runner Labels - needs: create-comment uses: ./.github/workflows/get-runner-labels.yml prepare-binding: @@ -151,57 +128,3 @@ jobs: pnpm tsx ecosystem-ci.ts run-suites ${{ matrix.suite }} - - update-comment: - runs-on: ubuntu-latest - needs: [create-comment, execute-selected-suite, execute-all] - if: always() - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }} - script: | - const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.runId, - per_page: 100 - }); - - const selectedSuite = context.payload.inputs.suite - let result - if (selectedSuite !== "-") { - const { conclusion, html_url } = jobs.find(job => job.name === "execute-selected-suite") - result = [{ suite: `${selectedSuite} ${context.payload.inputs.suiteRefType} ${context.payload.inputs.suiteRef}`, conclusion, link: html_url }] - } else { - result = jobs - .filter(job => job.name.startsWith('execute-all ')) - .map(job => { - const suite = job.name.replace(/^execute-all \(([^)]+)\)$/, "$1") - return { suite, conclusion: job.conclusion, link: job.html_url } - }) - } - - const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` - const urlLink = `[Open](${url})` - - const conclusionEmoji = { - success: ":white_check_mark:", - failure: ":x:", - cancelled: ":stop_button:" - } - - const body = ` - 📝 Ran ecosystem CI: ${urlLink} - - | suite | result | - |-------|--------| - ${result.map(r => `| [${r.suite}](${r.link}) | ${conclusionEmoji[r.conclusion]} ${r.conclusion} |`).join("\n")} - ` - - await github.rest.issues.updateComment({ - owner: 'web-infra-dev', - repo: 'rspack', - comment_id: ${{ needs.create-comment.outputs.comment-id }}, - body - })