File tree Expand file tree Collapse file tree 6 files changed +54
-7
lines changed Expand file tree Collapse file tree 6 files changed +54
-7
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,12 @@ name: Test my typescript action
2
2
3
3
on : pull_request
4
4
5
+ env :
6
+ IMAGE_NAME : alpine:3.10.1
7
+
5
8
jobs :
6
- test :
7
- name : Test
9
+ test1 :
10
+ name : Test for with parameter
8
11
runs-on : ubuntu-18.04
9
12
steps :
10
13
- uses : actions/checkout@v1
36
39
job_name : ' :ts: *test gitrivy*'
37
40
channel : ' #develop'
38
41
url : ${{ secrets.SLACK_WEBHOOK }}
42
+
43
+ test2 :
44
+ name : Test for getting image name from enviroment variable
45
+ runs-on : ubuntu-18.04
46
+ steps :
47
+ - uses : actions/checkout@v1
48
+
49
+ - name : Install dependencies
50
+ run : npm install
51
+
52
+ # - name: Test
53
+ # run: npm run test
54
+
55
+ - name : Build
56
+ run : npm run build
57
+
58
+ - name : Pull docker image
59
+ run : docker pull alpine:3.10.3
60
+
61
+ - uses : ./
62
+ with :
63
+ token : ${{ secrets.GITHUB_TOKEN }}
64
+ issue_label : trivy,vulnerability,test
65
+ issue_title : Security Alert Test
66
+ issue_assignee : homoluctus
67
+
68
+ -
uses :
homoluctus/[email protected]
69
+ if : always()
70
+ with :
71
+ type : ${{ job.status }}
72
+ job_name : ' :ts: *test gitrivy*'
73
+ channel : ' #develop'
74
+ url : ${{ secrets.SLACK_WEBHOOK }}
Original file line number Diff line number Diff line change 4
4
![ GitHub] ( https://img.shields.io/github/license/homoluctus/gitrivy?color=brightgreen )
5
5
6
6
This is a GitHub Actions to scan vulnerability using [ Trivy] ( https://github.com/aquasecurity/trivy ) .<br >
7
+ If vulnerabilities are found by Trivy, it creates the following GitHub Issue.
8
+
9
+ ![ image] ( https://github.com/homoluctus/gitrivy/blob/master/issue.png )
7
10
8
11
## Usage
9
12
@@ -13,7 +16,7 @@ This is a GitHub Actions to scan vulnerability using [Trivy](https://github.com/
13
16
| :--:| :--:| :--:| :--|
14
17
| token| True| N/A| GitHub access token<br >${{ secrets.GITHUB_TOKEN }} is recommended|
15
18
| trivy_version| False| latest| Trivy version|
16
- | image| True| N/A| The target image name to scan the vulnerability|
19
+ | image| True| N/A| The target image name to scan the vulnerability< br >Specify this parameter or ` IMAGE_NAME ` environment variable |
17
20
| severity| False| HIGH,CRITICAL| Sevirities of vulunerabilities (separeted by commma)|
18
21
| vuln_type| False| os,library| Scan target are os and / or library (separeted by commma)|
19
22
| ignore_unfixed| False| false| Ignore unfixed vulnerabilities<br >Specify true or false|
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ inputs:
10
10
default : ' latest'
11
11
required : false
12
12
image :
13
- description : ' The target image name of vulnerability scan'
14
- required : true
13
+ description : ' The target image name of vulnerability scan (specify this parameter or "IMAGE_NAME" environment variable '
14
+ required : false
15
15
severity :
16
16
description : ' sevirities of vulunerabilities (separeted by commma)'
17
17
default : ' HIGH,CRITICAL'
Original file line number Diff line number Diff line change @@ -6659,7 +6659,10 @@ function run() {
6659
6659
try {
6660
6660
const token = core.getInput('token', { required: true });
6661
6661
const trivyVersion = core.getInput('trivy_version').replace(/^v/, '');
6662
- const image = core.getInput('image', { required: true });
6662
+ const image = core.getInput('image') || process.env.IMAGE_NAME;
6663
+ if (image === undefined || image === '') {
6664
+ throw new Error('Please specify scan target image name');
6665
+ }
6663
6666
const trivyOptions = {
6664
6667
severity: core.getInput('severity').replace(/\s+/g, ''),
6665
6668
vulnType: core.getInput('vuln_type').replace(/\s+/g, ''),
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ async function run() {
9
9
try {
10
10
const token : string = core . getInput ( 'token' , { required : true } )
11
11
const trivyVersion : string = core . getInput ( 'trivy_version' ) . replace ( / ^ v / , '' )
12
- const image : string = core . getInput ( 'image' , { required : true } )
12
+ const image : string | undefined = core . getInput ( 'image' ) || process . env . IMAGE_NAME
13
+
14
+ if ( image === undefined || image === '' ) {
15
+ throw new Error ( 'Please specify scan target image name' )
16
+ }
17
+
13
18
const trivyOptions : TrivyOption = {
14
19
severity : core . getInput ( 'severity' ) . replace ( / \s + / g, '' ) ,
15
20
vulnType : core . getInput ( 'vuln_type' ) . replace ( / \s + / g, '' ) ,
You can’t perform that action at this time.
0 commit comments