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
+34-8Lines changed: 34 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ you are using. We currently support:
20
20
*[Ruby](ruby)
21
21
*[Scala](scala)
22
22
*[Docker](docker)
23
+
*[Setup](setup)
23
24
24
25
Here's an example of using one of the Actions, in this case to test a Node.js project:
25
26
@@ -60,11 +61,37 @@ jobs:
60
61
61
62
See the individual Actions linked above for per-language instructions.
62
63
63
-
Note: GitHub Actions will not pass on secrets set in the repository to forks being used in pull requests, and so the Snyk actions that require the token will fail to run.
64
+
Note that GitHub Actions will not pass on secrets set in the repository to forks being used in pull requests, and so the Snyk actions that require the token will fail to run.
64
65
65
-
## Getting your Snyk token
66
66
67
-
The Actions example above refer to a Snyk API token:
67
+
### Bring your own development environment
68
+
69
+
The per-language Actions automatically install all the required development tools for Snyk to determine the correct dependencies and hence vulnerabilities from different language environments. If you have a workflow where you already have those installed then you can instead use the `snyk/actions/setup` Action to just install Snyk
70
+
71
+
```yaml
72
+
name: Snyk example
73
+
on: push
74
+
jobs:
75
+
security:
76
+
runs-on: ubuntu-latest
77
+
steps:
78
+
- uses: actions/checkout@master
79
+
- uses: snyk/actions/setup@master
80
+
- uses: actions/setup-go@v1
81
+
with:
82
+
go-version: "1.13"
83
+
- name: Snyk monitor
84
+
run: snyk test
85
+
env:
86
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
87
+
```
88
+
89
+
The example here uses `actions/setup-go` would you would need to select the right actions to install the relevant development requirements for your project. If you are already using the same pipeline to build and test your application you're likely already doing so.
90
+
91
+
92
+
### Getting your Snyk token
93
+
94
+
The Actions example above refer to a Snyk API token:
68
95
69
96
```yaml
70
97
env:
@@ -73,10 +100,12 @@ env:
73
100
74
101
Every Snyk account has this token, and you can find it in one of two ways:
75
102
1. If you're using the [Snyk CLI](https://support.snyk.io/hc/en-us/articles/360003812458-Getting-started-with-the-CLI) you can retrieve it by running `snyk config get api`.
76
-
2. In the UI, go to your account's general settings page (https://app.snyk.io/account) and retrieve the API token, as shown in the following [Revoking and regenerating Snyk API tokens](https://support.snyk.io/hc/en-us/articles/360004008278-Revoking-and-regenerating-Snyk-API-tokens).
103
+
2. In the UI, go to your Snyk account's [settings page](https://app.snyk.io/account) and retrieve the API token, as shown in the following [Revoking and regenerating Snyk API tokens](https://support.snyk.io/hc/en-us/articles/360004008278-Revoking-and-regenerating-Snyk-API-tokens).
104
+
77
105
106
+
### Continuing on error
78
107
79
-
Note: The above examples will halt the action when issues are found. If you want to ensure the action continues, even if Snyk finds issues, then [conmtinue-on-error]https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error will need to be set.
108
+
The above examples will fail the workflow when issues are found. If you want to ensure the Action continues, even if Snyk finds vulnerabilities, then [continue-on-error](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error) can be used..
80
109
81
110
```yaml
82
111
name: Example workflow using Snyk with continue on error
A [GitHub Action](https://github.com/features/actions) for installing [Snyk](https://snyk.io) to check for
4
+
vulnerabilities.
5
+
6
+
You can use the Action as follows:
7
+
8
+
```yaml
9
+
name: Snyk example
10
+
on: push
11
+
jobs:
12
+
security:
13
+
runs-on: ubuntu-latest
14
+
steps:
15
+
- uses: actions/checkout@master
16
+
- uses: snyk/actions/setup@master
17
+
- uses: actions/setup-go@v1
18
+
with:
19
+
go-version: "1.13"
20
+
- name: Snyk monitor
21
+
run: snyk test
22
+
env:
23
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
24
+
```
25
+
26
+
When using the Setup Action you are responsible for setting up the development environment required to run Snyk.
27
+
In this case this is a Go project so `actions/setup-go` was used, but this would be specific to your project. The [language and frameworks guides](https://docs.github.com/en/actions/language-and-framework-guides) are a good starting point.
28
+
29
+
The Snyk Setup Action has properties which are passed to the underlying image. These are
30
+
passed to the action using `with`.
31
+
32
+
| Property | Default | Description |
33
+
| --- | --- | --- |
34
+
| snyk-version | latest | Install a specific version of Snyj |
35
+
36
+
The Action also has outputs:
37
+
38
+
| Property | Default | Description |
39
+
| --- | --- | --- |
40
+
| version | | The full version of the Snyk CLI installed |
41
+
42
+
For example, you can choose to install a specific version of Snyk. The installed version can be
0 commit comments