Skip to content

Commit

Permalink
chore: improve
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech committed Dec 20, 2024
1 parent c167c51 commit d0b9177
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/actions/image-scan/action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: "Image Vulnerability Scan"
description: "This action performs a Trivy scan on the image and adds a PR comment with the results."
inputs:
name:
description: "The name of service"
required: true

github_token:
description: 'GitHub Token'
required: true
Expand Down Expand Up @@ -43,16 +47,24 @@ runs:
if: success() && steps.scan.outcome == 'success'
with:
message: |
# Trivy Image scan passed
# ${{ inputs.name }} image scan passed
:white_check_mark: No security vulnerabilities found in image:
`${{ inputs.image_ref }}`.
```
${{ inputs.image_ref }}
```
- uses: mshick/add-pr-comment@v2
if: failure() && steps.scan.outcome == 'failure'
with:
message: |
# Trivy Image scan failed
:x: Image `${{ inputs.image_ref }}` has security vulnerabilities.
# ${{ inputs.name }} image scan failed
:x: Security vulnerabilities found in image:
```
${{ inputs.image_ref }}
```
Please check the security [vulnerabilities](https://github.com/wundergraph/cosmo/security/code-scanning?query=pr%3A${{ github.event.number }}+is%3Aopen+tool%3ATrivy) found in the PR.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/router-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ jobs:

- uses: ./.github/actions/image-scan
with:
name: "Router"
github_token: ${{secrets.GITHUB_TOKEN}}
image_ref: 'ghcr.io/wundergraph/cosmo/router:sha-${{ github.sha }}'

Expand Down

0 comments on commit d0b9177

Please sign in to comment.