Skip to content

Commit 9a2c359

Browse files
authored
Merge pull request #27 from thc202/release-v0.5.0
Allow to configure artifact name, release v0.5.0
2 parents 47bcf91 + 484dacf commit 9a2c359

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ All notable changes to this GitHub action will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7-
## [Unreleased]
7+
## [0.5.0] - 2023-08-24
8+
### Added
9+
- An input (`artifact_name`) used to name the artifact that contains the ZAP reports.
810

911
## [0.4.0] - 2023-08-02
1012
### Changed
@@ -34,7 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
3436

3537
First release to Marketplace.
3638

37-
[Unreleased]: https://github.com/zaproxy/action-api-scan/compare/v0.4.0...HEAD
39+
[0.5.0]: https://github.com/zaproxy/action-api-scan/compare/v0.4.0...v0.5.0
3840
[0.4.0]: https://github.com/zaproxy/action-api-scan/compare/v0.3.1...v0.4.0
3941
[0.3.1]: https://github.com/zaproxy/action-api-scan/compare/v0.3.0...v0.3.1
4042
[0.3.0]: https://github.com/zaproxy/action-api-scan/compare/v0.2.0...v0.3.0

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ You do not have to create a dedicated token. Make sure to use the GitHub's defau
5757
**Optional** By default ZAP Docker container will fail with an [exit code](https://github.com/zaproxy/zaproxy/blob/7abbd57f6894c2abf4f1ed00fb95e99c34ef2e28/docker/zap-api-scan.py#L35),
5858
if it identifies any alerts. Set this option to `true` if you want to fail the status of the GitHub Scan if ZAP identifies any alerts during the scan.
5959

60+
### `artifact_name`
61+
62+
**Optional** By default the action will attach the report to the build with the name `zap_scan`. Set this to a different string to name it something else. Consult [GitHub's documentation](https://github.com/actions/toolkit/blob/main/packages/artifact/docs/additional-information.md#non-supported-characters) for which artifact names are allowed.
63+
6064
## Environment variables
6165

6266
If set, the following [ZAP authentication environment variables](https://www.zaproxy.org/docs/authentication/handling-auth-yourself/#authentication-env-vars)
@@ -73,7 +77,7 @@ will be copied into the docker container:
7377
```
7478
steps:
7579
- name: ZAP Scan
76-
uses: zaproxy/action-api-scan@v0.4.0
80+
uses: zaproxy/action-api-scan@v0.5.0
7781
with:
7882
target: 'https://www.zaproxy.org/'
7983
```
@@ -94,7 +98,7 @@ jobs:
9498
ref: master
9599
96100
- name: ZAP Scan
97-
uses: zaproxy/action-api-scan@v0.4.0
101+
uses: zaproxy/action-api-scan@v0.5.0
98102
with:
99103
token: ${{ secrets.GITHUB_TOKEN }}
100104
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: 'The action will file the report to the GitHub issue using the issue_title input'
3838
required: false
3939
default: true
40+
artifact_name:
41+
description: 'The name of the artifact that contains the ZAP reports'
42+
required: false
43+
default: 'zap_scan'
4044
runs:
4145
using: 'node16'
4246
main: 'dist/index.js'

dist/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38342,6 +38342,7 @@ async function run() {
3834238342
let issueTitle = core.getInput('issue_title');
3834338343
let failAction = core.getInput('fail_action');
3834438344
let allowIssueWriting = core.getInput('allow_issue_writing');
38345+
let artifactName = core.getInput('artifact_name');
3834538346
let createIssue = true;
3834638347

3834738348
if (!(String(failAction).toLowerCase() === 'true' || String(failAction).toLowerCase() === 'false')) {
@@ -38351,6 +38352,12 @@ async function run() {
3835138352
if (String(allowIssueWriting).toLowerCase() === 'false') {
3835238353
createIssue = false;
3835338354
}
38355+
38356+
if (!artifactName) {
38357+
console.log('[WARNING]: \'artifact_name\' action input should not be empty. Setting it back to the default name.');
38358+
artifactName = 'zap_scan';
38359+
}
38360+
3835438361
console.log('starting the program');
3835538362
console.log('github run id :' + currentRunnerID);
3835638363

@@ -38387,7 +38394,7 @@ async function run() {
3838738394
console.log('Scanning process completed, starting to analyze the results!')
3838838395
}
3838938396
}
38390-
await common.main.processReport(token, workspace, plugins, currentRunnerID, issueTitle, repoName, createIssue);
38397+
await common.main.processReport(token, workspace, plugins, currentRunnerID, issueTitle, repoName, createIssue, artifactName);
3839138398
} catch (error) {
3839238399
core.setFailed(error.message);
3839338400
}

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ async function run() {
2323
let issueTitle = core.getInput('issue_title');
2424
let failAction = core.getInput('fail_action');
2525
let allowIssueWriting = core.getInput('allow_issue_writing');
26+
let artifactName = core.getInput('artifact_name');
2627
let createIssue = true;
2728

2829
if (!(String(failAction).toLowerCase() === 'true' || String(failAction).toLowerCase() === 'false')) {
@@ -32,6 +33,12 @@ async function run() {
3233
if (String(allowIssueWriting).toLowerCase() === 'false') {
3334
createIssue = false;
3435
}
36+
37+
if (!artifactName) {
38+
console.log('[WARNING]: \'artifact_name\' action input should not be empty. Setting it back to the default name.');
39+
artifactName = 'zap_scan';
40+
}
41+
3542
console.log('starting the program');
3643
console.log('github run id :' + currentRunnerID);
3744

@@ -68,7 +75,7 @@ async function run() {
6875
console.log('Scanning process completed, starting to analyze the results!')
6976
}
7077
}
71-
await common.main.processReport(token, workspace, plugins, currentRunnerID, issueTitle, repoName, createIssue);
78+
await common.main.processReport(token, workspace, plugins, currentRunnerID, issueTitle, repoName, createIssue, artifactName);
7279
} catch (error) {
7380
core.setFailed(error.message);
7481
}

0 commit comments

Comments
 (0)