From 9e90d7d22456c73bc8dab10bb2048e27cd31a21e Mon Sep 17 00:00:00 2001 From: swgu98 Date: Sat, 6 Sep 2025 05:33:00 +0000 Subject: [PATCH 1/2] add bypass --- .github/actions/check-bypass/action.yml | 41 +++++++++++++++++++ .github/workflows/approval.yml | 8 ++++ .github/workflows/check-bypass.yml | 52 +++++++++++++++++++++++++ .github/workflows/distribute-a100.yml | 10 +++++ .github/workflows/distribute-v100.yml | 10 +++++ .github/workflows/lint.yml | 10 +++++ 6 files changed, 131 insertions(+) create mode 100644 .github/actions/check-bypass/action.yml create mode 100644 .github/workflows/check-bypass.yml diff --git a/.github/actions/check-bypass/action.yml b/.github/actions/check-bypass/action.yml new file mode 100644 index 000000000000..316e6665453e --- /dev/null +++ b/.github/actions/check-bypass/action.yml @@ -0,0 +1,41 @@ +name: "Check bypass" +description: "A custom action to encapsulate PFCCLab/ci-bypass" +inputs: + github-token: + description: "GitHub token" + required: true + workflow-name: + description: "Workflow name" + required: true +outputs: + can-skip: + description: "Whether the workflow can be skipped." + value: ${{ steps.check-bypass.outputs.can-skip }} + +runs: + using: "composite" + steps: + - id: check-bypass + name: Check Bypass + env: + CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "XieYunshen","luotao1"]' + uses: PFCCLab/ci-bypass@v1 + with: + github-token: ${{ inputs.github-token }} + non-pull-request-event-strategy: 'never-skipped' + type: 'composite' + composite-rule: | + { + "any": [ + { + "type": "labeled", + "label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"], + "username": ${{ env.CI_TEAM_MEMBERS }} + }, + { + "type": "commented", + "comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"], + "username": ${{ env.CI_TEAM_MEMBERS }} + } + ] + } diff --git a/.github/workflows/approval.yml b/.github/workflows/approval.yml index e7e9ddb25d81..b2b69602a733 100644 --- a/.github/workflows/approval.yml +++ b/.github/workflows/approval.yml @@ -33,6 +33,14 @@ jobs: git checkout -b test_pr upstream/${BRANCH} git merge --no-edit origin_pr git log --pretty=oneline -10 + + - name: Check bypass + id: check-bypass + uses: ./.github/actions/check-bypass + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + workflow-name: approval + - name: Display Required Approvers if: steps.check-bypass.outputs.can-skip != 'true' run: | diff --git a/.github/workflows/check-bypass.yml b/.github/workflows/check-bypass.yml new file mode 100644 index 000000000000..acd7c89ef0fc --- /dev/null +++ b/.github/workflows/check-bypass.yml @@ -0,0 +1,52 @@ +on: + workflow_call: + inputs: + workflow-name: + required: true + type: string + secrets: + github-token: + required: true + outputs: + can-skip: + description: "Whether the workflow can be skipped." + value: ${{ jobs.check-bypass.outputs.can-skip }} + +jobs: + check-bypass: + name: Check bypass + runs-on: + group: APPROVAL + permissions: + contents: read + env: + CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1" , "XieYunshen","luotao1"]' + outputs: + can-skip: ${{ steps.check-bypass.outputs.can-skip }} + steps: + - name: Cleanup + run: | + rm -rf * .[^.]* + + - id: check-bypass + name: Check Bypass + uses: PFCCLab/ci-bypass@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + non-pull-request-event-strategy: 'never-skipped' + type: 'composite' + composite-rule: | + { + "any": [ + { + "type": "labeled", + "label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"], + "username": ${{ env.CI_TEAM_MEMBERS }} + }, + { + "type": "commented", + "comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"], + "username": ${{ env.CI_TEAM_MEMBERS }} + } + ] + } diff --git a/.github/workflows/distribute-a100.yml b/.github/workflows/distribute-a100.yml index 57b669cab515..de94a626e579 100644 --- a/.github/workflows/distribute-a100.yml +++ b/.github/workflows/distribute-a100.yml @@ -37,8 +37,18 @@ defaults: shell: bash jobs: + check-bypass: + name: Check bypass + uses: ./.github/workflows/check-bypass.yml + with: + workflow-name: 'distribute-a100' + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + distribute-a100-ci: name: distribute-a100-ci + needs: check-bypass + if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} runs-on: group: Distribute steps: diff --git a/.github/workflows/distribute-v100.yml b/.github/workflows/distribute-v100.yml index f01ea5b3e12d..f7989f931c12 100644 --- a/.github/workflows/distribute-v100.yml +++ b/.github/workflows/distribute-v100.yml @@ -37,8 +37,18 @@ defaults: shell: bash jobs: + check-bypass: + name: Check bypass + uses: ./.github/workflows/check-bypass.yml + with: + workflow-name: 'distribute-v100' + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + distribute-v100-ci: name: distribute-v100-ci + needs: check-bypass + if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} runs-on: group: Auto-Parallel steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6c8d208a56b6..be5fb1850350 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,8 +13,18 @@ env: TASK: PaddleNLP-CI-Lint-${{ github.event.pull_request.number }} jobs: + check-bypass: + name: Check bypass + uses: ./.github/workflows/check-bypass.yml + with: + workflow-name: 'lint' + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + Lint: name: Lint + needs: check-bypass + if: ${{ needs.check-bypass.outputs.can-skip != 'true' }} runs-on: [self-hosted, ernie-cpu] steps: - name: Run Container From fb57f52fee70f6b7d1193d548f969aa8b8f2bb45 Mon Sep 17 00:00:00 2001 From: swgu98 Date: Sat, 6 Sep 2025 05:34:58 +0000 Subject: [PATCH 2/2] add bypass --- .github/actions/check-bypass/action.yml | 2 +- .github/workflows/check-bypass.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-bypass/action.yml b/.github/actions/check-bypass/action.yml index 316e6665453e..2ed0b8526f91 100644 --- a/.github/actions/check-bypass/action.yml +++ b/.github/actions/check-bypass/action.yml @@ -18,7 +18,7 @@ runs: - id: check-bypass name: Check Bypass env: - CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "XieYunshen","luotao1"]' + CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "XieYunshen","luotao1","From00"]' uses: PFCCLab/ci-bypass@v1 with: github-token: ${{ inputs.github-token }} diff --git a/.github/workflows/check-bypass.yml b/.github/workflows/check-bypass.yml index acd7c89ef0fc..aace1a9bbaad 100644 --- a/.github/workflows/check-bypass.yml +++ b/.github/workflows/check-bypass.yml @@ -20,7 +20,7 @@ jobs: permissions: contents: read env: - CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1" , "XieYunshen","luotao1"]' + CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1" , "XieYunshen","luotao1","From00"]' outputs: can-skip: ${{ steps.check-bypass.outputs.can-skip }} steps: