Skip to content

Commit fdaa707

Browse files
committed
[index.ts] Support IMAGE_NAME environment variable
1 parent 657e795 commit fdaa707

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dist/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6659,7 +6659,10 @@ function run() {
66596659
try {
66606660
const token = core.getInput('token', { required: true });
66616661
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+
}
66636666
const trivyOptions = {
66646667
severity: core.getInput('severity').replace(/\s+/g, ''),
66656668
vulnType: core.getInput('vuln_type').replace(/\s+/g, ''),

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ async function run() {
99
try {
1010
const token: string = core.getInput('token', { required: true })
1111
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+
1318
const trivyOptions: TrivyOption = {
1419
severity: core.getInput('severity').replace(/\s+/g, ''),
1520
vulnType: core.getInput('vuln_type').replace(/\s+/g, ''),

0 commit comments

Comments
 (0)