File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,18 @@ jobs:
132132 with :
133133 github-token : ${{ secrets.GITHUB_TOKEN }}
134134 script : |
135+ const totalHighCritical = '${{ steps.create_summary.outputs.total_high_critical }}';
136+ const hasError = totalHighCritical === '';
137+ const hasVulnerabilities = parseInt(totalHighCritical) > 0;
135138 github.rest.repos.createCommitStatus({
136139 owner: context.repo.owner,
137140 repo: context.repo.repo,
138141 sha: '${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}',
139- state: '${{ steps.create_summary.outputs.total_high_critical > 0 && 'failure' || 'success' }} ',
142+ state: hasError ? 'error' : hasVulnerabilities ? 'failure' : 'success',
140143 target_url: '${{ steps.upload_results.outputs.https_s3_path }}/results.html',
141- description: ' Grype Scan Completed with ${{ steps.create_summary.outputs.total_high_critical }} high/critical vulnerabilities' ,
144+ description: hasError ? 'An error occurred' : ` Grype Scan Completed with ${totalHighCritical} high/critical vulnerabilities` ,
142145 context: 'Grype Scan ${{ steps.set_version.outputs.docker_image || inputs.docker_image }}'
143- })
146+ });
144147
145148 - name : Upload artifacts
146149 if : always()
You can’t perform that action at this time.
0 commit comments