From 8a4e1e7419806b60c5afaa4d6619c91a2abb79b3 Mon Sep 17 00:00:00 2001 From: hardfist Date: Thu, 19 Dec 2024 22:11:16 +0800 Subject: [PATCH] chore: remove all unnecessary workflow (#8783) --- .github/auto_assign.yml | 2 - .github/workflows/auto-assign.yaml | 10 -- .github/workflows/bench.yml | 83 --------------- .github/workflows/diff.yml.bak | 120 ---------------------- .github/workflows/get-runner-labels.yml | 2 +- .github/workflows/github-issue-sync.yml | 33 ------ .github/workflows/issue-mark-assignee.yml | 22 ---- 7 files changed, 1 insertion(+), 271 deletions(-) delete mode 100644 .github/auto_assign.yml delete mode 100644 .github/workflows/auto-assign.yaml delete mode 100644 .github/workflows/bench.yml delete mode 100644 .github/workflows/diff.yml.bak delete mode 100644 .github/workflows/github-issue-sync.yml delete mode 100644 .github/workflows/issue-mark-assignee.yml diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml deleted file mode 100644 index 47cb64687326..000000000000 --- a/.github/auto_assign.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Set to author to add assignees to pull requests -addAssignees: author diff --git a/.github/workflows/auto-assign.yaml b/.github/workflows/auto-assign.yaml deleted file mode 100644 index 1be7b11f6ecc..000000000000 --- a/.github/workflows/auto-assign.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: "Auto Assign" -on: - pull_request: - types: [opened, ready_for_review] - -jobs: - add-reviews: - runs-on: ubuntu-latest - steps: - - uses: kentaro-m/auto-assign-action@v2.0.0 diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml deleted file mode 100644 index 64424814e617..000000000000 --- a/.github/workflows/bench.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Benchmark - -on: - issue_comment: - types: [created] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: ${{ github.ref_name != 'main' }} - -jobs: - trigger: - runs-on: ubuntu-latest - if: 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.RSPACK_BOT_ACCESS_TOKEN }} - result-encoding: string - script: | - const prData = ${{ steps.get-pr-data.outputs.result }} - - await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: 'rspack-ecosystem-benchmark', - workflow_id: 'bench_rspack_pr.yml', - ref: 'main', - inputs: { - prNumber: '' + prData.num - } - }) diff --git a/.github/workflows/diff.yml.bak b/.github/workflows/diff.yml.bak deleted file mode 100644 index f6c3922fe94a..000000000000 --- a/.github/workflows/diff.yml.bak +++ /dev/null @@ -1,120 +0,0 @@ -# Diff assets comment with "!diff" - -name: Diff Assets - -on: - pull_request_review_comment: - types: [created] - issue_comment: - types: [created] - -jobs: - get-runner-labels: - name: Get Runner Labels - uses: ./.github/workflows/get-runner-labels.yml - - build: - name: Build - needs: [get-runner-labels] - if: (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && contains(github.event.comment.body, '!diff') - strategy: - matrix: - array: - - target: x86_64-unknown-linux-gnu # For Cloud IDE - runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }} - uses: ./.github/workflows/reusable-build.yml - with: - profile: "debug" - ref: refs/pull/${{ github.event.issue.number || github.event.pull_request.number }}/merge - target: ${{ matrix.array.target }} - runner: ${{ matrix.array.runner }} - test: false - - diff: - name: Diff Assets - needs: [build, get-runner-labels] - runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }} - steps: - - name: Checkout Branch - uses: actions/checkout@v4 - with: - fetch-depth: 1 - ref: refs/pull/${{ github.event.issue.number || github.event.pull_request.number }}/merge - - - name: Pnpm Cache - uses: ./.github/actions/pnpm-cache - - - name: Download bindings - uses: ./.github/actions/download-artifact - with: - name: bindings-x86_64-unknown-linux-gnu - path: crates/node_binding/ - try-local-cache: true - link-when-local: true - - - name: Build node packages - run: pnpm run build:js - - - name: Run Diff - run: node scripts/diff.cjs - - - name: Upload Report - shell: bash - env: - API_TOKEN_GITHUB: ${{ secrets.RSPACK_ACCESS_TOKEN }} - run: | - cache_dir="$HOME/.cache/diff_upload" - clone_dir="$cache_dir/${{ github.run_id }}" - - # Cleaning history upload cache - if [ -d $cache_dir ] - then - find $cache_dir -type d -maxdepth 1 -mindepth 1 -cmin +180 | xargs rm -rf - fi - - # Cloning into dest directory - mkdir -p $clone_dir - git config --global user.email "lingyucoder@gmail.com" - git config --global user.name "LingyuCoder" - git clone --single-branch --branch main "https://x-access-token:$API_TOKEN_GITHUB@github.com/web-infra-dev/rspack-report-website.git" $clone_dir - - # Copying content into dest repo - dest_dir="$clone_dir/diff/${{ github.run_id }}" - cp -R diff_output/. $dest_dir - - # Committing and pushing - cd $clone_dir - - current_time=$(date +%s) - gap=$((30 * 24 * 60 * 60)) - for cur_dir in ./diff/* ; do - create_time=$(git log --follow --format="%at" --date default $cur_dir | tail -1) - diff=$(($current_time - $create_time)) - if [ $diff -gt $gap ]; then - echo "Remove $cur_dir because it is older than a month" - rm -rf $cur_dir - fi - done - - commit_message="Update from https://github.com/web-infra-dev/rspack/commit/${{ github.sha }}" - git add . - if LC_ALL=C git status | grep -q "Changes to be committed" - then - git commit --message "$commit_message" - git push -u origin HEAD:main - else - echo "No changes detected" - fi - - # Cleaning upload cache - if [ -d $clone_dir ] - then - rm -rf $clone_dir - fi - - - name: Write a new comment - uses: peter-evans/create-or-update-comment@v4 - continue-on-error: true - with: - issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} - body-path: 'diff_output/stats.md' diff --git a/.github/workflows/get-runner-labels.yml b/.github/workflows/get-runner-labels.yml index db2ca62b3bd2..ba231579820e 100644 --- a/.github/workflows/get-runner-labels.yml +++ b/.github/workflows/get-runner-labels.yml @@ -22,7 +22,7 @@ on: jobs: main: name: Get Runner Labels - runs-on: [self-hosted, Linux, ci] + runs-on: [ubuntu-22.04] outputs: LINUX_RUNNER_LABELS: ${{ steps.run.outputs.LINUX_RUNNER_LABELS }} MACOS_RUNNER_LABELS: ${{ steps.run.outputs.MACOS_RUNNER_LABELS }} diff --git a/.github/workflows/github-issue-sync.yml b/.github/workflows/github-issue-sync.yml deleted file mode 100644 index cf70d25fea95..000000000000 --- a/.github/workflows/github-issue-sync.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: GitHub Issue Sync -on: - workflow_dispatch: - inputs: - excludeClosed: - description: "Exclude closed issues in the sync." - type: boolean - default: true - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Sync issues - uses: paritytech/github-issue-sync@v0.3.2 - with: - # This token is autogenerated by GitHub - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # This is a Personal Access Token and it needs to have the following permissions - # - "read:org": used to read the project's board - # - "write:org": used to assign issues to the project's board - PROJECT_TOKEN: ${{ secrets.RSPACK_ACCESS_TOKEN }} - # The number of the project which the issues will be synced to - # You can find this in https://github.com/orgs/@ORGANIZATION/projects/ - project: 12 - # Optional, the project field to modify with a new value - # Found more in https://docs.github.com/en/issues/planning-and-tracking-with-projects/understanding-fields/about-single-select-fields - project_field: Status - # Optional unless that project_field was set up. Then this field is required. - # The value to modify in the project field - project_value: 🆕 New - # Optional, labels to work with. Read below to see how to configure it. - # If this value is set, the action will be applied only to issues with such label(s). diff --git a/.github/workflows/issue-mark-assignee.yml b/.github/workflows/issue-mark-assignee.yml deleted file mode 100644 index b351e9fcb8d9..000000000000 --- a/.github/workflows/issue-mark-assignee.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Issue Mark Assignee - -on: - issue_comment: - types: [created, edited] - -permissions: - contents: read - -jobs: - issue-mark-assign: - permissions: - issues: write - runs-on: ubuntu-latest - if: github.repository_owner == 'web-infra-dev' - steps: - - name: mark assignee - uses: actions-cool/issues-helper@v3 - with: - actions: "mark-assignees" - token: ${{ secrets.GITHUB_TOKEN }} - require-permission: "none"