name: OpenSSF Scorecard

on:
  push:
    branches: [main]
  schedule:
    - cron: '0 6 * * 1'

permissions: read-all

jobs:
  scorecard:
    name: Scorecard
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      id-token: write
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false

      - uses: ossf/scorecard-action@v2.4.3
        with:
          results_file: results.sarif
          results_format: sarif
          publish_results: true

      - uses: actions/upload-artifact@v7
        with:
          name: SARIF file
          path: results.sarif
          retention-days: 5

      - uses: github/codeql-action/upload-sarif@v4
        with:
          sarif_file: results.sarif
