name: Update Duplicate Magnets Issue

on:
  schedule:
    - cron: "0 6 * * 1,4" # Mondays and Thursdays at 6 AM UTC
  workflow_dispatch:

jobs:
  update-duplicate-magnets:
    runs-on: ubuntu-latest
    if: github.repository == 'zed-industries/zed'
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

      - name: Set up Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
        with:
          python-version: "3.12"

      - name: Install dependencies
        run: pip install requests

      - name: Update duplicate magnets issue
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          python script/github-find-top-duplicated-bugs.py \
            --github-token "$GITHUB_TOKEN" \
            --issue-number 46355
