Skip to content

Commit 4c0bc99

Browse files
hzooArmin Sebastian
authored andcommitted
feat: add labels when locking (#4)
* add labels when locking * Update README.md * oops * Update README.md * Update lock.js
1 parent 022711d commit 4c0bc99

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ lockComment: >
4040
# - no-locking
4141
# Limit to only `issues` or `pulls`
4242
# only: issues
43+
# Add a label when locking. Set to `false` to disable
44+
# lockLabel: 'outdated'
4345
```
4446

4547
## How are issues and pull requests determined to be inactive?

src/lock.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = class Lock {
99

1010
async lock() {
1111
const {owner, repo} = this.context.repo();
12-
const {lockComment} = this.config;
12+
const {lockComment, lockLabel} = this.config;
1313

1414
const issues = await this.getLockableIssues();
1515
for (const issue of issues) {
@@ -23,6 +23,16 @@ module.exports = class Lock {
2323
body: lockComment
2424
});
2525
}
26+
27+
if (lockLabel) {
28+
this.logger.info(`[${issueUrl}] Labeling`);
29+
await this.context.github.issues.addLabels({
30+
owner,
31+
repo,
32+
number: issue.number,
33+
labels: [lockLabel]
34+
});
35+
}
2636

2737
this.logger.info(`[${issueUrl}] Locking`);
2838
await this.context.github.issues.lock({

0 commit comments

Comments
 (0)