File tree Expand file tree Collapse file tree 6 files changed +127
-1
lines changed
pre_commit_github_action.testdata Expand file tree Collapse file tree 6 files changed +127
-1
lines changed Original file line number Diff line number Diff line change 99alert : " off"
1010remediate : " off"
1111repository :
12- - type : dependabot_configured
12+ - type : pre_commit_github_action
1313 def :
1414 package_ecosystem : github-actions
1515 schedule_interval : daily
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 : 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 : NodeJS with Gulp
2+
3+ on :
4+ push :
5+ branches : [ "master" ]
6+ pull_request :
7+ branches : [ "master" ]
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+
13+ strategy :
14+ matrix :
15+ node-versiodn : [18.x, 20.x, 22.x]
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+ - uses : pre-commit/action@v3.0.1
20+
21+ - name : Use Node.js ${{ matrix.node-version }}
22+ uses : actions/setup-node@v3
23+ with :
24+ node-version-file : " package.json"
25+ node-versiosdn : ${{ matrix.node-version }}
26+
27+ - name : Build
28+ run : |
29+ npm install
30+ gulp
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+ print(actions)
36+ "pre-commit/action" in actions
37+ }
38+ # Defines the configuration for alerting on the rule
39+ alert :
40+ type : security_advisory
41+ security_advisory : {}
You can’t perform that action at this time.
0 commit comments