apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: daily-score
spec:
  schedule: "0 8 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: run-score
            image: gcr.io/openssf/cron:latest
            imagePullPolicy: Always
            command:
            - /bin/sh
            - -c
            - ./cron/cron.sh
            volumeMounts:
            - name: github-app-key
              mountPath: "/etc/github/"
              readOnly: true
            env:
            - name: GITHUB_APP_KEY_PATH
              value: /etc/github/app_key
            - name: GITHUB_APP_ID
              valueFrom:
                secretKeyRef:
                  name: github
                  key: app_id
            - name: GITHUB_APP_INSTALLATION_ID
              valueFrom:
                secretKeyRef:
                  name: github
                  key: installation_id
            - name: GCS_BUCKET
              value: ossf-scorecards

          volumes:
          - name: github-app-key
            secret:
              secretName: github
          restartPolicy: OnFailure
