---
name: Security

# yamllint disable-line rule:truthy
on:
  workflow_dispatch:
  schedule:
    - cron: "42 05 * * *"

concurrency:
  group: ${{ github.workflow }}
  cancel-in-progress: false

permissions:
  contents: read

jobs:
  container:
    if: github.repository_owner == 'searxng'
    name: Container
    runs-on: ubuntu-24.04-arm
    permissions:
      security-events: write

    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd  # v6.0.2
        with:
          persist-credentials: "false"

      - name: Sync GHCS from Docker Scout
        uses: docker/scout-action@bacf462e8d090c09660de30a6ccc718035f961e3  # v1.20.4
        with:
          organization: "searxng"
          dockerhub-user: "${{ secrets.DOCKER_USER }}"
          dockerhub-password: "${{ secrets.DOCKER_TOKEN }}"
          image: "registry://ghcr.io/searxng/searxng:latest"
          command: "cves"
          sarif-file: "./scout.sarif"
          exit-code: "false"
          write-comment: "false"

      - name: Upload SARIFs
        uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225  # v4.35.2
        with:
          sarif_file: "./scout.sarif"
