{"id":13529734,"url":"https://github.com/dessant/lock-threads","last_synced_at":"2025-05-15T07:05:10.989Z","repository":{"id":27437795,"uuid":"113918130","full_name":"dessant/lock-threads","owner":"dessant","description":"GitHub Action that locks closed issues, pull requests and discussions after a period of inactivity","archived":false,"fork":false,"pushed_at":"2024-02-15T22:43:57.000Z","size":1878,"stargazers_count":319,"open_issues_count":7,"forks_count":37,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-07T15:01:54.611Z","etag":null,"topics":["github-actions","issues","lock","pull-requests"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/lock-threads","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dessant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dessant","patreon":"dessant","custom":["https://armin.dev/go/paypal","https://armin.dev/go/bitcoin"]}},"created_at":"2017-12-11T23:05:09.000Z","updated_at":"2025-05-06T11:49:24.000Z","dependencies_parsed_at":"2023-11-12T04:26:22.734Z","dependency_job_id":"a7ab411f-ab19-4c14-a3a5-ad6d895e4851","html_url":"https://github.com/dessant/lock-threads","commit_stats":{"total_commits":114,"total_committers":4,"mean_commits":28.5,"dds":"0.42105263157894735","last_synced_commit":"c1b35aecc5cdb1a34539d14196df55838bb2f836"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dessant%2Flock-threads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dessant%2Flock-threads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dessant%2Flock-threads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dessant%2Flock-threads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dessant","download_url":"https://codeload.github.com/dessant/lock-threads/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292040,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","issues","lock","pull-requests"],"created_at":"2024-08-01T07:00:38.945Z","updated_at":"2025-05-15T07:05:05.973Z","avatar_url":"https://github.com/dessant.png","language":"JavaScript","funding_links":["https://github.com/sponsors/dessant","https://patreon.com/dessant","https://armin.dev/go/paypal","https://armin.dev/go/bitcoin"],"categories":["Community Resources","JavaScript","Bot Frameworks"],"sub_categories":["GitHub Tools and Management","Flaky Test Detection"],"readme":"# Lock Threads\n\nLock Threads is a GitHub Action that locks closed issues,\npull requests and discussions after a period of inactivity.\n\n\u003cimg width=\"800\" src=\"https://raw.githubusercontent.com/dessant/lock-threads/main/assets/screenshot.png\"\u003e\n\n## Supporting the Project\n\nThe continued development of Lock Threads is made possible\nthanks to the support of awesome backers. If you'd like to join them,\nplease consider contributing with\n[Patreon](https://armin.dev/go/patreon?pr=lock-threads\u0026src=repo),\n[PayPal](https://armin.dev/go/paypal?pr=lock-threads\u0026src=repo) or\n[Bitcoin](https://armin.dev/go/bitcoin?pr=lock-threads\u0026src=repo).\n\n## Usage\n\nCreate the `lock-threads.yml` workflow file in the `.github/workflows`\ndirectory, use one of the [example workflows](#examples) to get started.\n\n### Inputs\n\n\u003c!-- prettier-ignore --\u003e\nThe action can be configured using [input parameters](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith).\n\n- **`github-token`**\n  - GitHub access token, value must be `${{ github.token }}` or an encrypted\n    secret that contains a [personal access token](#using-a-personal-access-token)\n  - Optional, defaults to `${{ github.token }}`\n- **`issue-inactive-days`**\n  - Number of days of inactivity before a closed issue is locked\n  - Optional, defaults to `365`\n- **`exclude-issue-created-before`**\n  - Do not lock issues created before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-issue-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-issue-created-after`**\n  - Do not lock issues created after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-issue-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-issue-created-between`**\n  - Do not lock issues created in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`exclude-issue-closed-before`**\n  - Do not lock issues closed before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-issue-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-issue-closed-after`**\n  - Do not lock issues closed after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-issue-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-issue-closed-between`**\n  - Do not lock issues closed in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`include-any-issue-labels`**\n  - Only lock issues with any of these labels, value must be\n    a comma separated list of labels or `''`, ignored\n    when `include-all-issue-labels` is set\n  - Optional, defaults to `''`\n- **`include-all-issue-labels`**\n  - Only lock issues with all these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`exclude-any-issue-labels`**\n  - Do not lock issues with any of these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`add-issue-labels`**\n  - Labels to add before locking an issue, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`remove-issue-labels`**\n  - Labels to remove before locking an issue, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`issue-comment`**\n  - Comment to post before locking an issue\n  - Optional, defaults to `''`\n- **`issue-lock-reason`**\n  - Reason for locking an issue, value must be one\n    of `resolved`, `off-topic`, `too heated`, `spam` or `''`\n  - Optional, defaults to `resolved`\n- **`pr-inactive-days`**\n  - Number of days of inactivity before a closed pull request is locked\n  - Optional, defaults to `365`\n- **`exclude-pr-created-before`**\n  - Do not lock pull requests created before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-pr-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-pr-created-after`**\n  - Do not lock pull requests created after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-pr-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-pr-created-between`**\n  - Do not lock pull requests created in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`exclude-pr-closed-before`**\n  - Do not lock pull requests closed before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-pr-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-pr-closed-after`**\n  - Do not lock pull requests closed after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-pr-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-pr-closed-between`**\n  - Do not lock pull requests closed in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`include-any-pr-labels`**\n  - Only lock pull requests with any of these labels, value must be\n    a comma separated list of labels or `''`, ignored\n    when `include-all-pr-labels` is set\n  - Optional, defaults to `''`\n- **`include-all-pr-labels`**\n  - Only lock pull requests with all these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`exclude-any-pr-labels`**\n  - Do not lock pull requests with any of these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`add-pr-labels`**\n  - Labels to add before locking a pull request, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`remove-pr-labels`**\n  - Labels to remove before locking a pull request, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`pr-comment`**\n  - Comment to post before locking a pull request\n  - Optional, defaults to `''`\n- **`pr-lock-reason`**\n  - Reason for locking a pull request, value must be one\n    of `resolved`, `off-topic`, `too heated`, `spam` or `''`\n  - Optional, defaults to `resolved`\n- **`discussion-inactive-days`**\n  - Number of days of inactivity before a closed discussion is locked\n  - Optional, defaults to `365`\n- **`exclude-discussion-created-before`**\n  - Do not lock discussions created before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-discussion-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-discussion-created-after`**\n  - Do not lock discussions created after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-discussion-created-between` is set\n  - Optional, defaults to `''`\n- **`exclude-discussion-created-between`**\n  - Do not lock discussions created in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`exclude-discussion-closed-before`**\n  - Do not lock discussions closed before a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-discussion-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-discussion-closed-after`**\n  - Do not lock discussions closed after a given date,\n    value must follow ISO 8601, ignored\n    when `exclude-discussion-closed-between` is set\n  - Optional, defaults to `''`\n- **`exclude-discussion-closed-between`**\n  - Do not lock discussions closed in a given time interval,\n    value must follow ISO 8601\n  - Optional, defaults to `''`\n- **`include-any-discussion-labels`**\n  - Only lock discussions with any of these labels, value must be\n    a comma separated list of labels or `''`, ignored\n    when `include-all-discussion-labels` is set\n  - Optional, defaults to `''`\n- **`include-all-discussion-labels`**\n  - Only lock discussions with all these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`exclude-any-discussion-labels`**\n  - Do not lock discussions with any of these labels, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`add-discussion-labels`**\n  - Labels to add before locking a discussion, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`remove-discussion-labels`**\n  - Labels to remove before locking a discussion, value must be\n    a comma separated list of labels or `''`\n  - Optional, defaults to `''`\n- **`discussion-comment`**\n  - Comment to post before locking a discussion\n  - Optional, defaults to `''`\n- **`process-only`**\n  - Only lock issues, pull requests or discussions,\n    value must be a comma separated list, list items must be\n    one of `issues`, `prs` or `discussions`\n  - Optional, defaults to `''`\n- **`log-output`**\n  - Log output parameters, value must be either `true` or `false`\n  - Optional, defaults to `false`\n\n### Outputs\n\n\u003c!-- prettier-ignore --\u003e\n- **`issues`**\n  - Issues that have been locked, value is a JSON string in the form\n    of `[{\"owner\": \"actions\", \"repo\": \"toolkit\", \"issue_number\": 1}]`\n  - Defaults to `''`\n- **`prs`**\n  - Pull requests that have been locked, value is a JSON string in the form\n    of `[{\"owner\": \"actions\", \"repo\": \"toolkit\", \"issue_number\": 1}]`\n  - Defaults to `''`\n- **`discussions`**\n  - Discussions that have been locked, value is a JSON string in the form\n    of `[{\"owner\": \"actions\", \"repo\": \"toolkit\", \"discussion_number\": 1}]`\n  - Defaults to `''`\n\n## Examples\n\nThe following workflow will search once an hour for closed issues,\npull requests and discussions that have not had any activity\nin the past year and can be locked.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\nname: 'Lock Threads'\n\non:\n  schedule:\n    - cron: '0 * * * *'\n  workflow_dispatch:\n\npermissions:\n  issues: write\n  pull-requests: write\n  discussions: write\n\nconcurrency:\n  group: lock-threads\n\njobs:\n  action:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: dessant/lock-threads@v5\n```\n\nEdit the workflow after the initial backlog of issues, pull requests\nand discussions has been processed to reduce the frequency of scheduled runs.\nRunning the workflow only once a day helps reduce resource usage.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\non:\n  schedule:\n    - cron: '0 0 * * *'\n```\n\n### Available input parameters\n\nThis workflow declares all the available input parameters of the action\nand their default values. Any of the parameters can be omitted.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\nname: 'Lock Threads'\n\non:\n  schedule:\n    - cron: '0 0 * * *'\n  workflow_dispatch:\n\npermissions:\n  issues: write\n  pull-requests: write\n  discussions: write\n\nconcurrency:\n  group: lock-threads\n\njobs:\n  action:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          github-token: ${{ github.token }}\n          issue-inactive-days: '365'\n          exclude-issue-created-before: ''\n          exclude-issue-created-after: ''\n          exclude-issue-created-between: ''\n          exclude-issue-closed-before: ''\n          exclude-issue-closed-after: ''\n          exclude-issue-closed-between: ''\n          include-any-issue-labels: ''\n          include-all-issue-labels: ''\n          exclude-any-issue-labels: ''\n          add-issue-labels: ''\n          remove-issue-labels: ''\n          issue-comment: ''\n          issue-lock-reason: 'resolved'\n          pr-inactive-days: '365'\n          exclude-pr-created-before: ''\n          exclude-pr-created-after: ''\n          exclude-pr-created-between: ''\n          exclude-pr-closed-before: ''\n          exclude-pr-closed-after: ''\n          exclude-pr-closed-between: ''\n          include-any-pr-labels: ''\n          include-all-pr-labels: ''\n          exclude-any-pr-labels: ''\n          add-pr-labels: ''\n          remove-pr-labels: ''\n          pr-comment: ''\n          pr-lock-reason: 'resolved'\n          discussion-inactive-days: '365'\n          exclude-discussion-created-before: ''\n          exclude-discussion-created-after: ''\n          exclude-discussion-created-between: ''\n          exclude-discussion-closed-before: ''\n          exclude-discussion-closed-after: ''\n          exclude-discussion-closed-between: ''\n          include-any-discussion-labels: ''\n          include-all-discussion-labels: ''\n          exclude-any-discussion-labels: ''\n          add-discussion-labels: ''\n          remove-discussion-labels: ''\n          discussion-comment: ''\n          process-only: ''\n          log-output: false\n```\n\n### Filtering issues, pull requests and discussions\n\nThis step will lock only issues, and exclude issues created before 2018,\nor those with the `help wanted` or `upstream` labels applied.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          exclude-issue-created-before: '2018-01-01T00:00:00Z'\n          exclude-any-issue-labels: 'help wanted, upstream'\n          process-only: 'issues'\n```\n\nThis step will lock only pull requests, and exclude those\nwith the `wip` label applied.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          exclude-any-pr-labels: 'wip'\n          process-only: 'prs'\n```\n\nThis step will lock only issues, and exclude issues closed before 2018,\nor those created in 2018 and 2019.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          exclude-issue-created-between: '2018-01-01T00:00:00Z/2019-12-31T23:59:59.999Z'\n          exclude-issue-closed-before: '2018-01-01T00:00:00Z'\n          process-only: 'issues'\n```\n\nThis step will lock issues that have the `incomplete` _or_ `invalid`\nlabels applied, and pull requests that have the `qa: done` _and_ `published`\nlabels applied.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          include-any-issue-labels: 'incomplete, invalid'\n          include-all-pr-labels: 'qa: done, published'\n          process-only: 'issues, prs'\n```\n\nThis step will lock discussions that have not had any activity\nin the past 180 days, and have the `qa: verified` label applied.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          discussion-inactive-days: '180'\n          include-any-discussion-labels: 'qa: verified'\n          process-only: 'discussions'\n```\n\n### Commenting and labeling\n\nThis step will post a comment on issues and pull requests before locking them,\nand apply the `outdated` label to issues.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          add-issue-labels: 'outdated'\n          issue-comment: \u003e\n            This issue has been automatically locked since there\n            has not been any recent activity after it was closed.\n            Please open a new issue for related bugs.\n          pr-comment: \u003e\n            This pull request has been automatically locked since there\n            has not been any recent activity after it was closed.\n            Please open a new issue for related bugs.\n          process-only: 'issues, prs'\n```\n\nThis step will apply the `qa: done` and `archived` labels,\nand remove the `qa: primary` and `needs: user feedback` labels\nbefore locking issues.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          add-issue-labels: 'qa: done, archived'\n          remove-issue-labels: 'qa: primary, needs: user feedback'\n          process-only: 'issues'\n```\n\n### Using a personal access token\n\nThe action uses an installation access token by default to interact with GitHub.\nYou may also authenticate with a personal access token to perform actions\nas a GitHub user instead of the `github-actions` app.\n\nCreate a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)\nwith the `repo` or `public_repo` scopes enabled, and add the token as an\n[encrypted secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)\nfor the repository or organization, then provide the action with the secret\nusing the `github-token` input parameter.\n\n\u003c!-- prettier-ignore --\u003e\n```yaml\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}\n```\n\n## How are issues, pull requests and discussions determined to be inactive?\n\nThe action uses GitHub's [updated](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-when-an-issue-or-pull-request-was-created-or-last-updated)\nsearch qualifier to determine inactivity. Any change to an issue, pull request\nor discussion is considered an update, including new comments,\nor changing labels.\n\nAn easy way to see which threads will initially be locked is to add\nthe `updated` search qualifier to the issue, pull request or discussion\nsearch field for your repository, adjust the date based on the value\nof the `*-inactive-days` input parameter:\n`is:closed is:unlocked updated:\u003c2018-12-20`.\n\n## Why are only some issues, pull requests and discussions processed?\n\nTo avoid triggering abuse prevention mechanisms on GitHub, only 50 threads\nwill be handled at a time. If your repository has more than that,\nit will take a few hours or days to process them all.\n\n## License\n\nCopyright (c) 2017-2023 Armin Sebastian\n\nThis software is released under the terms of the MIT License.\nSee the [LICENSE](LICENSE) file for further information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdessant%2Flock-threads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdessant%2Flock-threads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdessant%2Flock-threads/lists"}