From 428611011878e477fa3bd72ddfa5be93df8edd6e Mon Sep 17 00:00:00 2001 From: neverland Date: Fri, 20 Dec 2024 21:42:39 +0800 Subject: [PATCH] chore(CI): remove bench-pr.yml (#4226) --- .github/workflows/bench-pr.yml | 87 ---------------------- .github/workflows/ecosystem-ci-trigger.yml | 5 +- 2 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/bench-pr.yml diff --git a/.github/workflows/bench-pr.yml b/.github/workflows/bench-pr.yml deleted file mode 100644 index 0e3ef1d892..0000000000 --- a/.github/workflows/bench-pr.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Benchmark PR - -# TODO: switch to actions -# on: -# issue_comment: -# types: [created] - -# cancel previous job runs for the same workflow + pr -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - trigger: - runs-on: ubuntu-latest - if: github.repository == 'web-infra-dev/rsbuild' && (github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench')) - steps: - - uses: actions/github-script@v7 - with: - script: | - const user = context.payload.sender.login - console.log(`Validate user: ${user}`) - - let hasTriagePermission = false - try { - const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ - owner: context.repo.owner, - repo: context.repo.repo, - username: user, - }); - hasTriagePermission = data.user.permissions.triage - } catch (e) { - console.warn(e) - } - - if (hasTriagePermission) { - console.log('Allowed') - await github.rest.reactions.createForIssueComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: context.payload.comment.id, - content: '+1', - }) - } else { - console.log('Not allowed') - await github.rest.reactions.createForIssueComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: context.payload.comment.id, - content: '-1', - }) - throw new Error('not allowed') - } - - uses: actions/github-script@v7 - id: get-pr-data - with: - script: | - console.log(`Get PR info: ${context.repo.owner}/${context.repo.repo}#${context.issue.number}`) - const { data: pr } = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number - }) - return { - num: context.issue.number, - branchName: pr.head.ref, - repo: pr.head.repo.full_name - } - - uses: actions/github-script@v7 - id: trigger - with: - github-token: ${{ secrets.REPO_SCOPED_TOKEN }} - result-encoding: string - script: | - const prData = ${{ steps.get-pr-data.outputs.result }} - - await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: 'web-infra-QoS', - workflow_id: 'pr-bench.yaml', - ref: 'master', - inputs: { - prNumber: '' + prData.num, - product: 'RSBUILD', - repo: 'rsbuild' - } - }) diff --git a/.github/workflows/ecosystem-ci-trigger.yml b/.github/workflows/ecosystem-ci-trigger.yml index 982a4b0ae3..d70a237bd9 100644 --- a/.github/workflows/ecosystem-ci-trigger.yml +++ b/.github/workflows/ecosystem-ci-trigger.yml @@ -1,9 +1,8 @@ name: ecosystem-ci trigger # TODO: switch to actions -# on: -# issue_comment: -# types: [created] +on: + workflow_dispatch: jobs: trigger: