Skip to content

Commit 8a29d89

Browse files
author
dessant
committed
feat: ignore threads with certain labels
Closes #1.
1 parent 888e5a8 commit 8a29d89

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ lockComment: >
3535
This thread has been automatically locked because it has not had recent
3636
activity. Please open a new issue for related bugs and link to relevant
3737
comments in this thread.
38+
# Issues or pull requests with these labels will not be locked
39+
# exemptLabels:
40+
# - no-locking
3841
# Limit to only `issues` or `pulls`
3942
# only: issues
4043
```

assets/app-description.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ lockComment: >
2222
This thread has been automatically locked because it has not had recent
2323
activity. Please open a new issue for related bugs and link to relevant
2424
comments in this thread.
25+
# Issues or pull requests with these labels will not be locked
26+
# exemptLabels:
27+
# - no-locking
2528
# Limit to only `issues` or `pulls`
2629
# only: issues
2730
```

src/lock.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,22 @@ module.exports = class Lock {
4040

4141
search() {
4242
const {owner, repo} = this.context.repo();
43-
const {daysUntilLock, only} = this.config;
43+
const {exemptLabels, daysUntilLock, only} = this.config;
4444
const timestamp = this.since(daysUntilLock)
4545
.toISOString()
4646
.replace(/\.\d{3}\w$/, '');
4747

4848
let query = `repo:${owner}/${repo} is:closed updated:<${timestamp}`;
49+
if (exemptLabels && exemptLabels.length) {
50+
const queryPart = exemptLabels
51+
.map(label => `-label:"${label}"`)
52+
.join(' ');
53+
query += ` ${queryPart}`;
54+
}
4955
if (only === 'issues') {
50-
query += ` is:issue`;
56+
query += ' is:issue';
5157
} else if (only === 'pulls') {
52-
query += ` is:pr`;
58+
query += ' is:pr';
5359
}
5460

5561
this.logger.info(`[${owner}/${repo}] Searching`);

0 commit comments

Comments
 (0)