dessant/lock-threads

Action not doing anything

astrojuanlu opened this issue · 2 comments

Hi! We have set up this action in a project, however it doesn't seem to be doing anything, and no output is given either:

https://github.com/sphinx-doc/sphinx/runs/3037935012

This has happened two days already. Is there a way to debug what's doing on, or increase the verbosity? There are lots of closed issues and pull requests that fulfill the conditions.

It appears the action has been locking issues during the last two workflow runs: https://github.com/sphinx-doc/sphinx/search?q=is%3Aissue+is%3Aclosed+is%3Alocked&type=issues

Errors will usually be surfaced in the logs, while debug logging can be enabled using an environment variable: https://docs.github.com/en/actions/managing-workflow-runs/enabling-debug-logging

If you'd like to log the list of locked issues, you could echo the output of the action, no debugging mode is needed:

name: 'Lock old threads'

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

permissions:
  issues: write
  pull-requests: write

jobs:
  action:
    runs-on: ubuntu-latest
    steps:
      - uses: dessant/lock-threads@v2
        id: lock
        with:
          issue-lock-inactive-days: '30'
          pr-lock-inactive-days: '30'
      - name: Log processed threads
        run: |
          if [ '${{ steps.lock.outputs.issues }}' ]; then
            echo "Issues:" && echo '${{ steps.lock.outputs.issues }}' | jq .
          fi
          if [ '${{ steps.lock.outputs.prs }}' ]; then
            echo "Pull requests:" && echo '${{ steps.lock.outputs.prs }}' | jq .
          fi

github-token is now optional, there was a breaking change in a dependency that looked like a permission error, and it was fixed after you've tested the action for the first time.

The above example will run once an hour, this is fine if you're not posting comments with the action, since locking alone will not generate notifications. Though make sure to change it back to run only once a day (cron: '0 0 * * *') after the backlog has been processed, which should happen in a couple of days.

Thanks for the quick response @dessant , I was relying on notifications and action output to say that "it wasn't doing anything" but I should have looked better. I appreciate all the tips too !