name: trivy

on:
  # schedule:
  #   - cron: '59 11 * * *'
  workflow_dispatch:

permissions: {}

jobs:
  trivy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write

    strategy:
      matrix:
        tag:
          - latest
          - full

    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          show-progress: false

      - uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # 0.32.0
        with:
          image-ref: ghcr.io/renovatebot/renovate:${{ matrix.tag }}
          format: 'sarif'
          output: 'trivy-results.sarif'

      - uses: github/codeql-action/upload-sarif@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
        with:
          sarif_file: trivy-results.sarif
          category: 'docker-image-${{ matrix.tag }}'
