mediamtx/.github/workflows/issue_lock.yml
dependabot[bot] 6b169ea44f
build(deps): bump actions/github-script from 6 to 7 (#4837)
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-08 10:31:29 +02:00

52 lines
1.4 KiB
YAML

name: issue_lock
on:
schedule:
- cron: '40 15 * * *'
workflow_dispatch:
jobs:
issue_lock:
runs-on: ubuntu-22.04
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { repo: { owner, repo } } = context;
const now = new Date();
for await (const res of github.paginate.iterator(
github.rest.issues.listForRepo, {
owner,
repo,
state: 'closed',
})) {
for (const issue of res.data) {
if (issue.locked) {
continue;
}
if ((now - new Date(issue.closed_at)) < 1000*60*60*24*31*6) {
continue;
}
if (!issue.pull_request) {
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'This issue is being locked automatically because it has been closed for more than 6 months.\n'
+ 'Please open a new issue in case you encounter a similar problem.',
});
}
github.rest.issues.lock({
owner,
repo,
issue_number: issue.number,
});
}
}