Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: prevent image scans on main image builds #1300

Merged
merged 1 commit into from
May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ jobs:
cache-to: type=gha,mode=max

- uses: actions/cache@v2.1.4
if: ${{ github.event_name == 'pull_request' }}
with:
path: .trivy
key: ${{ runner.os }}-trivy-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-trivy-

- name: Run Trivy vulnerability scanner
if: ${{ github.event_name == 'pull_request' }}
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ steps.var.outputs.docker_tag }}
Expand All @@ -124,9 +126,11 @@ jobs:
cache-dir: .trivy

- name: Upload Trivy scan results to GitHub Security tab
if: ${{ github.event_name == 'pull_request' }}
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results.sarif'

- name: Correct Trivy cache permissions
if: ${{ github.event_name == 'pull_request' }}
run: sudo chown -R $USER:$GROUP .trivy