diff --git a/lib/stale.js b/lib/stale.js index 0c13b8d..f12974d 100644 --- a/lib/stale.js +++ b/lib/stale.js @@ -155,7 +155,7 @@ module.exports = class Stale { if (closeComment) { await this.github.issues.createComment({ owner, repo, number, body: closeComment }) } - return this.github.issues.edit({ owner, repo, number, state: 'closed' }) + return this.github.issues.update({ owner, repo, number, state: 'closed', state_reason: 'not_planned' }) } else { this.logger.info('%s/%s#%d would have been closed (dry-run)', owner, repo, number) } diff --git a/test/stale.test.js b/test/stale.test.js index aedf1e6..d877b2d 100644 --- a/test/stale.test.js +++ b/test/stale.test.js @@ -30,7 +30,7 @@ describe('stale', () => { createLabel: issueAction, addLabels: issueAction, createComment: issueAction, - edit: issueAction + update: issueAction }, search: { issues: issueAction @@ -108,8 +108,9 @@ describe('stale', () => { comments++ return Promise.resolve(notFoundError) }) - github.issues.edit = ({ owner, repo, number, state }) => { + github.issues.update = ({ owner, repo, number, state, state_reason }) => { if (state === 'closed') { + expect(state_reason).toBe('not_planned') closed++ } }