Reusable GitHub Action for locking merged pull requests after a configurable delay.
name: Lock Merged PRson:
pull_request:
types: [closed]workflow_dispatch:
permissions:
pull-requests: writecontents: writejobs:
lock-merged:
if: github.event.pull_request.merged == trueruns-on: ubuntu-lateststeps:
- uses: libnudget/lock@v1with:
token: ${{ secrets.GITHUB_TOKEN }}| Name | Required | Default | Notes |
|---|---|---|---|
token | yes | GitHub token with PR write access | |
days-before-lock | no | 0 | Days after merge before locking |
lock-reason | no | resolved | Reason for locking (resolved, off-topic, duplicated, spam) |
delete-branch | no | true | Delete the branch after merging |
- Triggers when a PR is merged
- Waits for the configured delay (default 1 day)
- Locks the PR with the specified reason
- Optionally deletes the merged branch
- Uses
workflow_dispatchfor manual triggering - Requires
pull-requests: writeandcontents: writepermissions (write needed for branch deletion)
MIT