From 648c5e62f220ababc100a2b60e0394ab556f539c Mon Sep 17 00:00:00 2001 From: d_infinite <463394797@qq.com> Date: Tue, 26 Apr 2022 16:11:12 +0800 Subject: [PATCH] feat: exit-code --- .github/workflows/test.yml | 3 ++- README.md | 11 ++++++----- action.yaml | 6 +++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4f3029..4a79a84 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,4 +19,5 @@ jobs: - uses: chaitin/veinmind-action@main with: scan-action: scan-host - image-ref: weakpass:latest \ No newline at end of file + image-ref: weakpass:latest + exit-code: 1 \ No newline at end of file diff --git a/README.md b/README.md index 1c97ba4..17151d0 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ jobs: ## 🏳️‍🌈 参数设置 -| 参数名称 | 参数作用 | 默认值 | -| ----------- | -------------- | --------- | -| scan-action | 扫描功能类型 | scan-host | -| image-ref | 镜像 Reference | | - +| 参数名称 | 参数作用 | 默认值 | +| ----------- | ---------------------------- | --------- | +| scan-action | 扫描功能类型 | scan-host | +| image-ref | 镜像 Reference | | +| exit-code | 当发现安全问题时的程序退出码 | 0 | +| output | 报告输出名称 | | \ No newline at end of file diff --git a/action.yaml b/action.yaml index ee2387f..3e83c67 100644 --- a/action.yaml +++ b/action.yaml @@ -12,6 +12,10 @@ inputs: image-ref: description: 'image reference' required: true + exit-code: + description: 'exit-code when specified security issue found' + required: false + default: '0' output: description: 'save results to output file' required: false @@ -19,7 +23,7 @@ inputs: runs: using: 'composite' steps: - - run: mkdir data && bash run.sh ${{ inputs.scan-action }} ${{ inputs.image-ref }} -o /data/${{ inputs.output }} + - run: mkdir data && bash run.sh ${{ inputs.scan-action }} ${{ inputs.image-ref }} -o /data/${{ inputs.output }} -e ${{ inputs.exit-code }} shell: bash - uses: actions/upload-artifact@v2 with: