Skip to content

Commit

Permalink
feat: add labels when locking (#4)
Browse files Browse the repository at this point in the history
* add labels when locking

* Update README.md

* oops

* Update README.md

* Update lock.js
  • Loading branch information
hzoo authored and Armin Sebastian committed May 1, 2018
1 parent 022711d commit 4c0bc99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ lockComment: >
# - no-locking
# Limit to only `issues` or `pulls`
# only: issues
# Add a label when locking. Set to `false` to disable
# lockLabel: 'outdated'
```

## How are issues and pull requests determined to be inactive?
Expand Down
12 changes: 11 additions & 1 deletion src/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = class Lock {

async lock() {
const {owner, repo} = this.context.repo();
const {lockComment} = this.config;
const {lockComment, lockLabel} = this.config;

const issues = await this.getLockableIssues();
for (const issue of issues) {
Expand All @@ -23,6 +23,16 @@ module.exports = class Lock {
body: lockComment
});
}

if (lockLabel) {
this.logger.info(`[${issueUrl}] Labeling`);
await this.context.github.issues.addLabels({
owner,
repo,
number: issue.number,
labels: [lockLabel]
});
}

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

0 comments on commit 4c0bc99

Please sign in to comment.