Skip to content

Commit 462597f

Browse files
authored
add bypass (#11077)
* add bypass * add bypass
1 parent 85295b6 commit 462597f

File tree

6 files changed

+131
-0
lines changed

6 files changed

+131
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Check bypass"
2+
description: "A custom action to encapsulate PFCCLab/ci-bypass"
3+
inputs:
4+
github-token:
5+
description: "GitHub token"
6+
required: true
7+
workflow-name:
8+
description: "Workflow name"
9+
required: true
10+
outputs:
11+
can-skip:
12+
description: "Whether the workflow can be skipped."
13+
value: ${{ steps.check-bypass.outputs.can-skip }}
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- id: check-bypass
19+
name: Check Bypass
20+
env:
21+
CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "XieYunshen","luotao1","From00"]'
22+
uses: PFCCLab/ci-bypass@v1
23+
with:
24+
github-token: ${{ inputs.github-token }}
25+
non-pull-request-event-strategy: 'never-skipped'
26+
type: 'composite'
27+
composite-rule: |
28+
{
29+
"any": [
30+
{
31+
"type": "labeled",
32+
"label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"],
33+
"username": ${{ env.CI_TEAM_MEMBERS }}
34+
},
35+
{
36+
"type": "commented",
37+
"comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"],
38+
"username": ${{ env.CI_TEAM_MEMBERS }}
39+
}
40+
]
41+
}

.github/workflows/approval.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ jobs:
3333
git checkout -b test_pr upstream/${BRANCH}
3434
git merge --no-edit origin_pr
3535
git log --pretty=oneline -10
36+
37+
- name: Check bypass
38+
id: check-bypass
39+
uses: ./.github/actions/check-bypass
40+
with:
41+
github-token: ${{ secrets.GITHUB_TOKEN }}
42+
workflow-name: approval
43+
3644
- name: Display Required Approvers
3745
if: steps.check-bypass.outputs.can-skip != 'true'
3846
run: |

.github/workflows/check-bypass.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
workflow-name:
5+
required: true
6+
type: string
7+
secrets:
8+
github-token:
9+
required: true
10+
outputs:
11+
can-skip:
12+
description: "Whether the workflow can be skipped."
13+
value: ${{ jobs.check-bypass.outputs.can-skip }}
14+
15+
jobs:
16+
check-bypass:
17+
name: Check bypass
18+
runs-on:
19+
group: APPROVAL
20+
permissions:
21+
contents: read
22+
env:
23+
CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1" , "XieYunshen","luotao1","From00"]'
24+
outputs:
25+
can-skip: ${{ steps.check-bypass.outputs.can-skip }}
26+
steps:
27+
- name: Cleanup
28+
run: |
29+
rm -rf * .[^.]*
30+
31+
- id: check-bypass
32+
name: Check Bypass
33+
uses: PFCCLab/ci-bypass@v1
34+
with:
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
non-pull-request-event-strategy: 'never-skipped'
37+
type: 'composite'
38+
composite-rule: |
39+
{
40+
"any": [
41+
{
42+
"type": "labeled",
43+
"label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"],
44+
"username": ${{ env.CI_TEAM_MEMBERS }}
45+
},
46+
{
47+
"type": "commented",
48+
"comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"],
49+
"username": ${{ env.CI_TEAM_MEMBERS }}
50+
}
51+
]
52+
}

.github/workflows/distribute-a100.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,18 @@ defaults:
3737
shell: bash
3838

3939
jobs:
40+
check-bypass:
41+
name: Check bypass
42+
uses: ./.github/workflows/check-bypass.yml
43+
with:
44+
workflow-name: 'distribute-a100'
45+
secrets:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
4048
distribute-a100-ci:
4149
name: distribute-a100-ci
50+
needs: check-bypass
51+
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
4252
runs-on:
4353
group: Distribute
4454
steps:

.github/workflows/distribute-v100.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,18 @@ defaults:
3737
shell: bash
3838

3939
jobs:
40+
check-bypass:
41+
name: Check bypass
42+
uses: ./.github/workflows/check-bypass.yml
43+
with:
44+
workflow-name: 'distribute-v100'
45+
secrets:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
4048
distribute-v100-ci:
4149
name: distribute-v100-ci
50+
needs: check-bypass
51+
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
4252
runs-on:
4353
group: Auto-Parallel
4454
steps:

.github/workflows/lint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ env:
1313
TASK: PaddleNLP-CI-Lint-${{ github.event.pull_request.number }}
1414

1515
jobs:
16+
check-bypass:
17+
name: Check bypass
18+
uses: ./.github/workflows/check-bypass.yml
19+
with:
20+
workflow-name: 'lint'
21+
secrets:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
1624
Lint:
1725
name: Lint
26+
needs: check-bypass
27+
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
1828
runs-on: [self-hosted, ernie-cpu]
1929
steps:
2030
- name: Run Container

0 commit comments

Comments
 (0)