Skip to content

Commit 3c437e9

Browse files
authored
✨ feat: support bypass CI by comment (#8)
1 parent 033d7cf commit 3c437e9

File tree

10 files changed

+4583
-4408
lines changed

10 files changed

+4583
-4408
lines changed

.github/workflows/example-workflow.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches:
99
- main
1010

11+
env:
12+
ACTIONS_RUNNER_DEBUG: true
13+
1114
jobs:
1215
check-bypass:
1316
name: Check Bypass
@@ -32,11 +35,16 @@ jobs:
3235
type: 'composite'
3336
composite-rule: |
3437
{
35-
"all": [
38+
"any": [
3639
{
3740
"type": "labeled",
3841
"label": ["ci-bypass: example", "ci-bypass: all"],
3942
"username": ["SigureMo"]
43+
},
44+
{
45+
"type": "commented",
46+
"comment-pattern": [".+/bypass example.+", ".+/bypass all.+"],
47+
"username": ["SigureMo"]
4048
}
4149
]
4250
}

__tests__/rules.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, assert } from 'vitest'
1+
import { describe, it } from 'vitest'
22
import { ByPassCheckerBuilder } from '../src/rules/index.js'
33
import { AbstractRule } from '../src/rules/base.js'
44
import { type PullRequestContext } from '../src/context.js'

action.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'ci-bypass'
2-
description: 'A GitHub Action to bypass CI checks based on rules'
2+
description: 'Bypass CI checks for GitHub Actions'
33
author: 'SigureMo'
44

55
# Add your action's branding here. This will appear on the GitHub Marketplace.
@@ -9,25 +9,34 @@ branding:
99

1010
# Define your inputs here.
1111
inputs:
12+
# Basic options
1213
github-token:
1314
description: 'GitHub token to interact with the GitHub API'
1415
required: false
1516
non-pull-request-event-strategy:
1617
description: 'Strategy to apply to non-pull-request events, can be always-skipped, never-skipped, or always-failed, default is always-failed'
1718
required: true
1819
default: 'always-failed'
20+
# Select the type of the rule
1921
type:
2022
description: 'Type of the rule, can be labeled, commented, approved, or composite'
2123
required: true
22-
label:
23-
description: 'Label name, can be a string or an array of strings'
24-
required: false
24+
# Common options for all types
2525
username:
26-
description: 'Username, can be a string or an array of strings'
26+
description: 'Username, can be a string or an array of strings separated by |'
2727
required: false
2828
user-team:
29-
description: 'User team, can be a string or an array of strings'
29+
description: 'User team, can be a string or an array of strings separated by |'
30+
required: false
31+
# For labeled rule
32+
label:
33+
description: 'Label name, can be a string or an array of strings separated by |'
34+
required: false
35+
# For commented rule
36+
comment-pattern:
37+
description: 'Comment regex pattern, can be a string or an array of strings separated by |'
3038
required: false
39+
# For commented rule
3140
composite-rule:
3241
description: 'Use any, all or not to combine multiple rules, need to be a JSON string'
3342
required: false

0 commit comments

Comments
 (0)