name: Count points

on:
  schedule:
    # Run at 00:00 on the first day of every month
    - cron: '0 0 1 * *'
  workflow_dispatch:
    inputs:
      startDate:
        description: 'Start date for point counter (YYYY-MM-DD)'
        required: true
        type: string

jobs:
  count-points:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - name: Set up environment
        uses: ./.github/actions/setup
        with:
          download-translations: 'false'
      - name: Count points
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          START_DATE: ${{ inputs.startDate }}
        run: node .github/scripts/count-points.mjs
