Skip to content

Commit f55d002

Browse files
authored
Merge pull request #62 from wochinge/master
update existing issue
2 parents 0bfcfee + 995f2ce commit f55d002

File tree

7 files changed

+3385
-4375
lines changed

7 files changed

+3385
-4375
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ If vulnerabilities are found by Trivy, it creates the following GitHub Issue.
2424
|issue_title|False|Security Alert|Issue title|
2525
|issue_label|False|trivy,vulnerability|Issue label (separated by commma)|
2626
|issue_assignee|False|N/A|Issue assignee (separated by commma)|
27+
|fail_on_vulnerabilities|False|false|Whether the action should fail if any vulnerabilities were found.|
2728

2829
### Outputs
2930

__tests__/trivy.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('getDownloadUrl', () => {
3636
const os = 'Linux';
3737
const result = await downloader['getDownloadUrl'](version, os);
3838
expect(result).toMatch(
39-
/releases\/download\/v[0-9]\.[0-9]\.[0-9]\/trivy_[0-9]\.[0-9]\.[0-9]_Linux-64bit\.tar\.gz$/
39+
/releases\/download\/v[0-9]+\.[0-9]+\.[0-9]+\/trivy_[0-9]+\.[0-9]+\.[0-9]+_Linux-64bit\.tar\.gz$/
4040
);
4141
});
4242

@@ -198,14 +198,16 @@ describe('Trivy scan', () => {
198198
});
199199

200200
describe('Parse', () => {
201+
const image: string = 'alpine:3.10';
202+
201203
test('the result without vulnerabilities', () => {
202204
const vulnerabilities: Vulnerability[] = [
203205
{
204206
Target: 'alpine:3.10 (alpine 3.10.3)',
205207
Vulnerabilities: null,
206208
},
207209
];
208-
const result = trivy.parse(vulnerabilities);
210+
const result = trivy.parse(image, vulnerabilities);
209211
expect(result).toBe('');
210212
});
211213

@@ -248,10 +250,11 @@ describe('Parse', () => {
248250
],
249251
},
250252
];
251-
const result = trivy.parse(vulnerabilities);
253+
const result = trivy.parse(image, vulnerabilities);
252254
expect(result).toMatch(
253255
/\|Title\|Severity\|CVE\|Package Name\|Installed Version\|Fixed Version\|References\|/
254256
);
257+
expect(result).toContain(image);
255258
});
256259
});
257260

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ inputs:
3939
issue_assignee:
4040
description: 'Issue assignee (separated by commma)'
4141
required: false
42+
fail_on_vulnerabilities:
43+
description: Whether the action should fail if a vulnerability was found
44+
default: 'false'
45+
required: false
4246

4347
outputs:
4448
issue_number:

0 commit comments

Comments
 (0)