File tree 4 files changed +88
-0
lines changed
pre_commit_github_action.testdata
4 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ tests :
2
+ - name : " Should have pre-commit enabled"
3
+ def : {}
4
+ params : {}
5
+ expect : " pass"
6
+ git :
7
+ repo_base : good
8
+ - name : " Should not have pre-commit enabled"
9
+ def : {}
10
+ params : {}
11
+ expect : " fail"
12
+ git :
13
+ repo_base : bad
Original file line number Diff line number Diff line change
1
+ name : NodeJS with Gulp
2
+ ' on ' :
3
+ push :
4
+ branches :
5
+ - master
6
+ pull_request :
7
+ branches :
8
+ - master
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+ - name : Use Node.js
15
+ uses : actions/setup-node@v3
16
+ with :
17
+ node-version-file : package.json
18
+ - name : Build
19
+ run : |
20
+ npm install
21
+ gulp
Original file line number Diff line number Diff line change
1
+ name : pre-commit
2
+
3
+ on :
4
+ pull_request :
5
+ push :
6
+ branches : [main]
7
+
8
+ jobs :
9
+ pre-commit :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v3
13
+ - uses : actions/setup-python@v3
14
+ -
uses :
pre-commit/[email protected]
Original file line number Diff line number Diff line change
1
+ ---
2
+ version : v1
3
+ release_phase : alpha
4
+ type : rule-type
5
+ name : pre_commit_github_action
6
+ display_name : Require running `pre-commit` using GitHub Actions
7
+ short_failure_message : " `https://github.com/pre-commit/action` action is not configured"
8
+ severity :
9
+ value : medium
10
+ context : {}
11
+ description : |
12
+ Verifies that `pre-commit` is configured via a GitHub action for the repository.
13
+ guidance : |
14
+ Run your `pre-commit` checks in GitHub Actions as well.
15
+ def :
16
+ in_entity : repository
17
+ rule_schema :
18
+ type : object
19
+ properties : {}
20
+ ingest :
21
+ type : git
22
+ git : {}
23
+ eval :
24
+ type : rego
25
+ rego :
26
+ type : deny-by-default
27
+ def : |
28
+ package minder
29
+
30
+ import rego.v1
31
+ actions := github_workflow.ls_actions("./.github/workflows")
32
+ default message := "pre-commit GitHub action is not configured"
33
+ default allow := false
34
+ allow if {
35
+ "pre-commit/action" in actions
36
+ }
37
+ # Defines the configuration for alerting on the rule
38
+ alert :
39
+ type : security_advisory
40
+ security_advisory : {}
You can’t perform that action at this time.
0 commit comments