name: 'Lock Inactive Threads'

on:
  schedule:
    # midnight UTC, every Wednesday, for Issues
    - cron: '0 0 * * 3'
    # midnight UTC, every Thursday, for PRs
    - cron: '0 0 * * 4'
  # allow manual triggering from GitHub UI
  workflow_dispatch:

permissions:
  issues: write
  pull-requests: write

concurrency:
  group: lock

jobs:
  action:
    runs-on: ubuntu-latest
    steps:
      - uses: dessant/lock-threads@v5
        with:
          github-token: ${{ github.token }}
          # after how many days of inactivity should a closed issue/PR be locked?
          issue-inactive-days: '365'
          pr-inactive-days: '365'
          # do not close feature request issues...
          # we close those but track them in https://github.com/microsoft/LightGBM/issues/2302
          exclude-any-issue-labels: 'feature request'
          # what labels should be removed prior to locking?
          remove-issue-labels: 'awaiting response,awaiting review,blocking,in progress'
          remove-pr-labels: 'awaiting response,awaiting review,blocking,in progress'
          # what message should be posted prior to locking?
          issue-comment: >
            This issue has been automatically locked since there has not been any recent activity since it was closed.
            To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
            including a reference to this.
          pr-comment: >
            This pull request has been automatically locked since there has not been any recent activity since it was closed.
            To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
            including a reference to this.
          # what should the locking status be?
          issue-lock-reason: 'resolved'
          pr-lock-reason: 'resolved'
          process-only: ${{ github.event.schedule == '0 0 * * 3' && 'issues' || 'prs' }}
