You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+93-4Lines changed: 93 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This action scans your pull requests for dependency changes and will raise an error if any new dependencies have existing vulnerabilities. The action is supported by an [API endpoint](https://docs.github.com/en/rest/reference/dependency-graph#dependency-review) that diffs the dependencies between any two revisions.
4
4
5
-
The action is available for all public repositories, as well as private repositories that have Github Advanced Security licensed.
5
+
The action is available for all public repositories, as well as private repositories that have Github Advanced Security licensed.
6
6
7
7
<imgwidth="854"alt="Screen Shot 2022-03-31 at 1 10 51 PM"src="https://user-images.githubusercontent.com/2161/161042286-b22d7dd3-13cb-458d-8744-ce70ed9bf562.png">
8
8
@@ -25,10 +25,99 @@ jobs:
25
25
- name: 'Checkout Repository'
26
26
uses: actions/checkout@v3
27
27
- name: 'Dependency Review'
28
-
uses: actions/dependency-review-action@v1
28
+
uses: actions/dependency-review-action@v2
29
29
```
30
30
31
-
Please keep in mind that you need a GitHub Advanced Security license if you're running this Action on private repos.
31
+
Please keep in mind that you need a GitHub Advanced Security license if you're running this action on private repos.
32
+
33
+
## Configuration
34
+
You can pass additional options to the Dependency Review
35
+
Action using your workflow file. Here's an example workflow with
36
+
all the possible configurations:
37
+
38
+
```yaml
39
+
name: 'Dependency Review'
40
+
on: [pull_request]
41
+
permissions:
42
+
contents: read
43
+
jobs:
44
+
dependency-review:
45
+
runs-on: ubuntu-latest
46
+
steps:
47
+
- name: 'Checkout Repository'
48
+
uses: actions/checkout@v3
49
+
- name: Dependency Review
50
+
uses: actions/dependency-review-action@v2
51
+
with:
52
+
# Possible values: "critical", "high", "moderate", "low"
53
+
# fail-on-severity: critical
54
+
#
55
+
# You can only can only include one of these two options: `allow-licenses` and `deny-licences`
56
+
#
57
+
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
58
+
# allow-licenses: GPL-3.0, BSD-3-Clause, MIT
59
+
#
60
+
# Possible values: Any `spdx_id` value(s) from https://docs.github.com/en/rest/licenses
61
+
# deny-licenses: LGPL-2.0, BSD-2-Clause
62
+
```
63
+
64
+
### Vulnerability Severity
65
+
66
+
By default the action will fail on any pull request that contains a
67
+
vulnerable dependency, regardless of the severity level. You can override this behavior by
68
+
using the `fail-on-severity` option, which will cause a failure on any pull requests that introduce vulnerabilities of the specified severity level or higher. The possible values are: `critical`, `high`, `moderate`, or `low`. The
69
+
action defaults to `low`.
70
+
71
+
This example will only fail on pull requests with `critical` and `high` vulnerabilities:
72
+
73
+
```yaml
74
+
- name: Dependency Review
75
+
uses: actions/dependency-review-action@v2
76
+
with:
77
+
fail-on-severity: high
78
+
```
79
+
80
+
### Licenses
81
+
82
+
You can set the action to fail on pull requests based on the licenses of the dependencies
83
+
they introduce. With `allow-licenses` you can define the list of licenses
84
+
your repository will accept. Alternatively, you can use `deny-licenses` to only
85
+
forbid a subset of licenses.
86
+
87
+
You can use the [Licenses
88
+
API](https://docs.github.com/en/rest/licenses) to see the full list of
89
+
supported licenses. Use the `spdx_id` field for every license you want
90
+
to filter. A couple of examples:
91
+
92
+
```yaml
93
+
# only allow MIT-licensed dependents
94
+
- name: Dependency Review
95
+
uses: actions/dependency-review-action@v2
96
+
with:
97
+
allow-licenses: MIT
98
+
```
99
+
100
+
```yaml
101
+
# Block Apache 1.1 and 2.0 licensed dependents
102
+
- name: Dependency Review
103
+
uses: actions/dependency-review-action@v2
104
+
with:
105
+
deny-licenses: Apache-1.1, Apache-2.0
106
+
```
107
+
108
+
**Important**
109
+
110
+
* The action will only accept one of the two parameters; an error will
111
+
be raised if you provide both.
112
+
* By default both parameters are empty (no license checking is
113
+
performed).
114
+
* We don't have license information for all of your dependents. If we
115
+
can't detect the license for a dependency **we will inform you, but the
116
+
action won't fail**.
117
+
118
+
## Blocking pull requests
119
+
120
+
The Dependency Review GitHub Action check will only block a pull request from being merged if the repository owner has required the check to pass before merging. For more information, see the [documentation on protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-status-checks-before-merging).
0 commit comments