name: stale_assignee_digest
on:
  schedule:
    - cron: '30 7 * * 1'
  workflow_dispatch:
permissions:
  contents: read
  issues: write
env:
  NODE_VERSION: '20'
jobs:
  stale_assignee_digest:
    if: ${{ github.repository == 'internetarchive/openlibrary'}}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
      - uses: actions/cache@v4
        id: cache-octokit
        with:
          path: 'node_modules'
          # Cache key shared across workflows
          key: ${{ runner.os }}-node${{ env.NODE_VERSION}}-octokit-${{ hashFiles('**/package-lock.json') }}
      - if: steps.cache-octokit.outputs.cache-hit != 'true'
        run: npm install @octokit/action
      - run: node scripts/gh_scripts/stale_assignee_digest.mjs --repoOwner "internetarchive" --daysSince 14
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
