Merge pull request #48 from ioaiaaii/chore/text-improvements #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Cache Update on Master | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - go.mod | |
| - '**.go' | |
| jobs: | |
| cache-go-modules: | |
| name: Cache Go Modules | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Cache Go Modules | |
| id: go-mod-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| vendor | |
| ~/go/pkg/mod | |
| key: go-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| go-mod-${{ runner.os }}- | |
| - name: Sync Go Modules (if cache is not hit) | |
| if: steps.go-mod-cache.outputs.cache-hit != 'true' | |
| run: make go-mod-sync | |
| cache-trivy: | |
| name: Cache Trivy Database | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - id: trivy-db | |
| name: Check Trivy DB SHA | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| endpoint='/orgs/aquasecurity/packages/container/trivy-db/versions' | |
| headers='Accept: application/vnd.github+json' | |
| jqFilter='.[] | select(.metadata.container.tags[] | contains("latest")) | .name | sub("sha256:";"")' | |
| sha=$(gh api -H "${headers}" "${endpoint}" | jq --raw-output "${jqFilter}") | |
| echo "Trivy DB sha256:${sha}" | |
| echo "SHA=${sha}" >> "$GITHUB_OUTPUT" | |
| - name: Cache Trivy Database | |
| id: trivy-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: trivy/.cache | |
| key: trivy-db-${{ runner.os }}-${{ steps.trivy-db.outputs.SHA }} | |
| restore-keys: | | |
| trivy-db-${{ runner.os }}- | |
| - name: Initialize Trivy Database (if needed) | |
| if: steps.trivy-cache.outputs.cache-hit != 'true' | |
| run: make trivy-scan TRIVY_ARGS="fs --download-db-only --cache-dir trivy/.cache" |