name: update-top-issues-ranking

on:
  workflow_dispatch:
  schedule:
    - cron: '0 10 * * *'

jobs:
  update:
    runs-on: ubuntu-latest
    if: github.repository_owner == 'opentofu'
    permissions:
      contents: read
      issues: write
    steps:
    - name: Checkout
      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
    - name: Setup Go
      uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
      with:
        go-version: 1.22
    - name: Update top issues ranking
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        cd .github/scripts/update_top_issues_ranking
        go mod download
        go run main.go opentofu opentofu 1496
