Filter comments by content instead of actor (#519)
* Filter comments by content instead of actor * Remove dead actor code * WIP fix tests * Fix test
This commit is contained in:
parent
678bfc7a59
commit
d901397e11
|
@ -1139,7 +1139,6 @@ class IssuesProcessorBuilder {
|
||||||
build(): IssuesProcessorMock {
|
build(): IssuesProcessorMock {
|
||||||
return new IssuesProcessorMock(
|
return new IssuesProcessorMock(
|
||||||
this._options,
|
this._options,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? this._issues : []),
|
async p => (p === 1 ? this._issues : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -48,7 +48,6 @@ describe('assignees options', (): void => {
|
||||||
const setProcessor = () => {
|
const setProcessor = () => {
|
||||||
processor = new IssuesProcessorMock(
|
processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? testIssueList : []),
|
async p => (p === 1 ? testIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-opt
|
||||||
export class IssuesProcessorMock extends IssuesProcessor {
|
export class IssuesProcessorMock extends IssuesProcessor {
|
||||||
constructor(
|
constructor(
|
||||||
options: IIssuesProcessorOptions,
|
options: IIssuesProcessorOptions,
|
||||||
getActor?: () => Promise<string>,
|
|
||||||
getIssues?: (page: number) => Promise<Issue[]>,
|
getIssues?: (page: number) => Promise<Issue[]>,
|
||||||
listIssueComments?: (
|
listIssueComments?: (
|
||||||
issueNumber: number,
|
issueNumber: number,
|
||||||
|
@ -19,10 +18,6 @@ export class IssuesProcessorMock extends IssuesProcessor {
|
||||||
) {
|
) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
if (getActor) {
|
|
||||||
this.getActor = getActor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getIssues) {
|
if (getIssues) {
|
||||||
this.getIssues = getIssues;
|
this.getIssues = getIssues;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ test('processing an issue with no label will make it stale and close it, if it i
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -48,7 +47,6 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -80,7 +78,6 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -112,7 +109,6 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -144,7 +140,6 @@ test('processing an issue with no label and a start date as ECMAScript epoch in
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -176,7 +171,6 @@ test('processing an issue with no label and a start date as ISO 8601 being befor
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -208,7 +202,6 @@ test('processing an issue with no label and a start date as ISO 8601 being after
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -240,7 +233,6 @@ test('processing an issue with no label and a start date as RFC 2822 being befor
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -272,7 +264,6 @@ test('processing an issue with no label and a start date as RFC 2822 being after
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -296,7 +287,6 @@ test('processing an issue with no label will make it stale and close it, if it i
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -321,7 +311,6 @@ test('processing an issue with no label will make it stale and not close it, if
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -344,7 +333,6 @@ test('processing an issue with no label will make it stale and not close it if d
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -368,7 +356,6 @@ test('processing an issue with no label will make it stale and not close it if d
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -392,7 +379,6 @@ test('processing an issue with no label will not make it stale if days-before-st
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -417,7 +403,6 @@ test('processing an issue with no label will not make it stale if days-before-st
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -445,7 +430,6 @@ test('processing an issue with no label will make it stale but not close it', as
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -476,7 +460,6 @@ test('processing a stale issue will close it', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -507,7 +490,6 @@ test('processing a stale issue containing a space in the label will close it', a
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -538,7 +520,6 @@ test('processing a stale issue containing a slash in the label will close it', a
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -570,7 +551,6 @@ test('processing a stale issue will close it when days-before-issue-stale overri
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -601,7 +581,6 @@ test('processing a stale PR will close it', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -633,7 +612,6 @@ test('processing a stale PR will close it when days-before-pr-stale override day
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -665,7 +643,6 @@ test('processing a stale issue will close it even if configured not to mark as s
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -698,7 +675,6 @@ test('processing a stale issue will close it even if configured not to mark as s
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -730,7 +706,6 @@ test('processing a stale PR will close it even if configured not to mark as stal
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -763,7 +738,6 @@ test('processing a stale PR will close it even if configured not to mark as stal
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -791,7 +765,6 @@ test('closed issues will not be marked stale', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => []
|
async () => []
|
||||||
);
|
);
|
||||||
|
@ -818,7 +791,6 @@ test('stale closed issues will not be closed', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -846,7 +818,6 @@ test('closed prs will not be marked stale', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -874,7 +845,6 @@ test('stale closed prs will not be closed', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -901,10 +871,8 @@ test('locked issues will not be marked stale', async () => {
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(DefaultProcessorOptions, async p =>
|
||||||
DefaultProcessorOptions,
|
p === 1 ? TestIssueList : []
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : [])
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// process our fake issue list
|
// process our fake issue list
|
||||||
|
@ -930,7 +898,6 @@ test('stale locked issues will not be closed', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -957,10 +924,8 @@ test('locked prs will not be marked stale', async () => {
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(DefaultProcessorOptions, async p =>
|
||||||
DefaultProcessorOptions,
|
p === 1 ? TestIssueList : []
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : [])
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// process our fake issue list
|
// process our fake issue list
|
||||||
|
@ -986,7 +951,6 @@ test('stale locked prs will not be closed', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1016,7 +980,6 @@ test('exempt issue labels will not be marked stale', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1046,7 +1009,6 @@ test('exempt issue labels will not be marked stale (multi issue label with space
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1075,7 +1037,6 @@ test('exempt issue labels will not be marked stale (multi issue label)', async (
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1122,7 +1083,6 @@ test('exempt pr labels will not be marked stale', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1151,14 +1111,14 @@ test('exempt issue labels will not be marked stale and will remove the existing
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [
|
async () => [
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
login: 'notme',
|
login: 'notme',
|
||||||
type: 'User'
|
type: 'User'
|
||||||
}
|
},
|
||||||
|
body: 'Body'
|
||||||
}
|
}
|
||||||
], // return a fake comment to indicate there was an update
|
], // return a fake comment to indicate there was an update
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1206,7 +1166,6 @@ test('stale issues should not be closed if days is set to -1', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1234,14 +1193,14 @@ test('stale label should be removed if a comment was added to a stale issue', as
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [
|
async () => [
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
login: 'notme',
|
login: 'notme',
|
||||||
type: 'User'
|
type: 'User'
|
||||||
}
|
},
|
||||||
|
body: 'Body'
|
||||||
}
|
}
|
||||||
], // return a fake comment to indicate there was an update
|
], // return a fake comment to indicate there was an update
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1275,14 +1234,14 @@ test('when the option "labelsToAddWhenUnstale" is set, the labels should be adde
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [
|
async () => [
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
login: 'notme',
|
login: 'notme',
|
||||||
type: 'User'
|
type: 'User'
|
||||||
}
|
},
|
||||||
|
body: 'Body'
|
||||||
}
|
}
|
||||||
], // return a fake comment to indicate there was an update
|
], // return a fake comment to indicate there was an update
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1315,14 +1274,14 @@ test('stale label should not be removed if a comment was added by the bot (and t
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [
|
async () => [
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
login: 'abot',
|
login: 'abot',
|
||||||
type: 'User'
|
type: 'User'
|
||||||
}
|
},
|
||||||
|
body: 'This issue is stale'
|
||||||
}
|
}
|
||||||
], // return a fake comment to indicate there was an update by the bot
|
], // return a fake comment to indicate there was an update by the bot
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1355,9 +1314,8 @@ test('stale label containing a space should be removed if a comment was added to
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [{user: {login: 'notme', type: 'User'}}], // return a fake comment to indicate there was an update
|
async () => [{user: {login: 'notme', type: 'User'}, body: 'Body'}], // return a fake comment to indicate there was an update
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1387,7 +1345,6 @@ test('stale issues should not be closed until after the closed number of days',
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1420,7 +1377,6 @@ test('stale issues should be closed if the closed nubmer of days (additive) is a
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1452,7 +1408,6 @@ test('stale issues should not be closed until after the closed number of days (l
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1485,7 +1440,6 @@ test('skips stale message on issues when stale-issue-message is empty', async ()
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1530,7 +1484,6 @@ test('send stale message on issues when stale-issue-message is not empty', async
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1575,7 +1528,6 @@ test('skips stale message on prs when stale-pr-message is empty', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1620,7 +1572,6 @@ test('send stale message on prs when stale-pr-message is not empty', async () =>
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1662,7 +1613,6 @@ test('git branch is deleted when option is enabled', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1692,7 +1642,6 @@ test('git branch is not deleted when issue is not pull request', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1724,7 +1673,6 @@ test('an issue without a milestone will be marked as stale', async () => {
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
DefaultProcessorOptions,
|
DefaultProcessorOptions,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1758,7 +1706,6 @@ test('an issue without an exempted milestone will be marked as stale', async ()
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1792,7 +1739,6 @@ test('an issue with an exempted milestone will not be marked as stale', async ()
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1826,7 +1772,6 @@ test('an issue with an exempted milestone will not be marked as stale (multi mil
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1860,7 +1805,6 @@ test('an issue with an exempted milestone will not be marked as stale (multi mil
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1895,7 +1839,6 @@ test('an issue with an exempted milestone but without an exempted issue mileston
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1930,7 +1873,6 @@ test('an issue with an exempted milestone but with another exempted issue milest
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1965,7 +1907,6 @@ test('an issue with an exempted milestone and with an exempted issue milestone w
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -1993,7 +1934,6 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2020,7 +1960,6 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2047,7 +1986,6 @@ test('processing an issue opened since 2 days and with the option "daysBeforeIss
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2081,7 +2019,6 @@ test('processing a pull request opened since 2 days and with the option "daysBef
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2115,7 +2052,6 @@ test('processing a pull request opened since 2 days and with the option "daysBef
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2149,7 +2085,6 @@ test('processing a pull request opened since 2 days and with the option "daysBef
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2186,7 +2121,6 @@ test('processing a previously closed issue with a close label will remove the cl
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2222,7 +2156,6 @@ test('processing a closed issue with a close label will not remove the close lab
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2258,7 +2191,6 @@ test('processing a locked issue with a close label will not remove the close lab
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
@ -2298,7 +2230,6 @@ test('processing an issue stale since less than the daysBeforeStale with a stale
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async (): Promise<IComment[]> => Promise.resolve([]),
|
async (): Promise<IComment[]> => Promise.resolve([]),
|
||||||
async () => labelCreatedAt.toDateString()
|
async () => labelCreatedAt.toDateString()
|
||||||
|
@ -2339,7 +2270,6 @@ test('processing an issue stale since less than the daysBeforeStale without a st
|
||||||
];
|
];
|
||||||
const processor = new IssuesProcessorMock(
|
const processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? TestIssueList : []),
|
async p => (p === 1 ? TestIssueList : []),
|
||||||
async (): Promise<IComment[]> => Promise.resolve([]),
|
async (): Promise<IComment[]> => Promise.resolve([]),
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -39,7 +39,6 @@ describe('milestones options', (): void => {
|
||||||
const setProcessor = () => {
|
const setProcessor = () => {
|
||||||
processor = new IssuesProcessorMock(
|
processor = new IssuesProcessorMock(
|
||||||
opts,
|
opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? testIssueList : []),
|
async p => (p === 1 ? testIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -1139,7 +1139,6 @@ class IssuesProcessorBuilder {
|
||||||
build(): IssuesProcessorMock {
|
build(): IssuesProcessorMock {
|
||||||
return new IssuesProcessorMock(
|
return new IssuesProcessorMock(
|
||||||
this._options,
|
this._options,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? this._issues : []),
|
async p => (p === 1 ? this._issues : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -205,7 +205,6 @@ class SUT {
|
||||||
private async _setProcessor(): Promise<number> {
|
private async _setProcessor(): Promise<number> {
|
||||||
this.processor = new IssuesProcessorMock(
|
this.processor = new IssuesProcessorMock(
|
||||||
this._opts,
|
this._opts,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? this._testIssueList : []),
|
async p => (p === 1 ? this._testIssueList : []),
|
||||||
async () => [],
|
async () => [],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -539,14 +539,14 @@ class IssuesProcessorBuilder {
|
||||||
build(): IssuesProcessorMock {
|
build(): IssuesProcessorMock {
|
||||||
return new IssuesProcessorMock(
|
return new IssuesProcessorMock(
|
||||||
this._options,
|
this._options,
|
||||||
async () => 'abot',
|
|
||||||
async p => (p === 1 ? this._issues : []),
|
async p => (p === 1 ? this._issues : []),
|
||||||
async () => [
|
async () => [
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
login: 'notme',
|
login: 'notme',
|
||||||
type: 'User'
|
type: 'User'
|
||||||
}
|
},
|
||||||
|
body: 'body'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
async () => new Date().toDateString()
|
async () => new Date().toDateString()
|
||||||
|
|
|
@ -291,7 +291,6 @@ class IssuesProcessor {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// get the next batch of issues
|
// get the next batch of issues
|
||||||
const issues = yield this.getIssues(page);
|
const issues = yield this.getIssues(page);
|
||||||
const actor = yield this.getActor();
|
|
||||||
if (issues.length <= 0) {
|
if (issues.length <= 0) {
|
||||||
this._logger.info(logger_service_1.LoggerService.green(`No more issues found to process. Exiting...`));
|
this._logger.info(logger_service_1.LoggerService.green(`No more issues found to process. Exiting...`));
|
||||||
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
|
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.setOperationsCount(this.operations.getConsumedOperationsCount()).logStats();
|
||||||
|
@ -309,7 +308,7 @@ class IssuesProcessor {
|
||||||
}
|
}
|
||||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||||
yield issueLogger.grouping(`$$type #${issue.number}`, () => __awaiter(this, void 0, void 0, function* () {
|
yield issueLogger.grouping(`$$type #${issue.number}`, () => __awaiter(this, void 0, void 0, function* () {
|
||||||
yield this.processIssue(issue, actor, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale);
|
yield this.processIssue(issue, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (!this.operations.hasRemainingOperations()) {
|
if (!this.operations.hasRemainingOperations()) {
|
||||||
|
@ -323,7 +322,7 @@ class IssuesProcessor {
|
||||||
return this.processIssues(page + 1);
|
return this.processIssues(page + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
processIssue(issue, actor, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale) {
|
processIssue(issue, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementProcessedItemsCount(issue);
|
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementProcessedItemsCount(issue);
|
||||||
|
@ -472,7 +471,7 @@ class IssuesProcessor {
|
||||||
// Process the issue if it was marked stale
|
// Process the issue if it was marked stale
|
||||||
if (issue.isStale) {
|
if (issue.isStale) {
|
||||||
issueLogger.info(`This $$type is already stale`);
|
issueLogger.info(`This $$type is already stale`);
|
||||||
yield this._processStaleIssue(issue, staleLabel, actor, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel);
|
yield this._processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel);
|
||||||
}
|
}
|
||||||
IssuesProcessor._endIssueProcessing(issue);
|
IssuesProcessor._endIssueProcessing(issue);
|
||||||
});
|
});
|
||||||
|
@ -499,20 +498,6 @@ class IssuesProcessor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// get the actor from the GitHub token or context
|
|
||||||
getActor() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let actor;
|
|
||||||
try {
|
|
||||||
this.operations.consumeOperation();
|
|
||||||
actor = yield this.client.users.getAuthenticated();
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return github_1.context.actor;
|
|
||||||
}
|
|
||||||
return actor.data.login;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// grab issues from github in batches of 100
|
// grab issues from github in batches of 100
|
||||||
getIssues(page) {
|
getIssues(page) {
|
||||||
var _a;
|
var _a;
|
||||||
|
@ -564,12 +549,12 @@ class IssuesProcessor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// handle all of the stale issue logic when we find a stale issue
|
// handle all of the stale issue logic when we find a stale issue
|
||||||
_processStaleIssue(issue, staleLabel, actor, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel) {
|
_processStaleIssue(issue, staleLabel, staleMessage, labelsToAddWhenUnstale, labelsToRemoveWhenUnstale, closeMessage, closeLabel) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||||
const markedStaleOn = (yield this.getLabelCreationDate(issue, staleLabel)) || issue.updated_at;
|
const markedStaleOn = (yield this.getLabelCreationDate(issue, staleLabel)) || issue.updated_at;
|
||||||
issueLogger.info(`$$type marked stale on: ${logger_service_1.LoggerService.cyan(markedStaleOn)}`);
|
issueLogger.info(`$$type marked stale on: ${logger_service_1.LoggerService.cyan(markedStaleOn)}`);
|
||||||
const issueHasComments = yield this._hasCommentsSince(issue, markedStaleOn, actor);
|
const issueHasComments = yield this._hasCommentsSince(issue, markedStaleOn, staleMessage);
|
||||||
issueLogger.info(`$$type has been commented on: ${logger_service_1.LoggerService.cyan(issueHasComments)}`);
|
issueLogger.info(`$$type has been commented on: ${logger_service_1.LoggerService.cyan(issueHasComments)}`);
|
||||||
const daysBeforeClose = issue.isPullRequest
|
const daysBeforeClose = issue.isPullRequest
|
||||||
? this._getDaysBeforePrClose()
|
? this._getDaysBeforePrClose()
|
||||||
|
@ -614,7 +599,7 @@ class IssuesProcessor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// checks to see if a given issue is still stale (has had activity on it)
|
// checks to see if a given issue is still stale (has had activity on it)
|
||||||
_hasCommentsSince(issue, sinceDate, actor) {
|
_hasCommentsSince(issue, sinceDate, staleMessage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
const issueLogger = new issue_logger_1.IssueLogger(issue);
|
||||||
issueLogger.info(`Checking for comments on $$type since: ${logger_service_1.LoggerService.cyan(sinceDate)}`);
|
issueLogger.info(`Checking for comments on $$type since: ${logger_service_1.LoggerService.cyan(sinceDate)}`);
|
||||||
|
@ -623,8 +608,8 @@ class IssuesProcessor {
|
||||||
}
|
}
|
||||||
// find any comments since the date
|
// find any comments since the date
|
||||||
const comments = yield this.listIssueComments(issue.number, sinceDate);
|
const comments = yield this.listIssueComments(issue.number, sinceDate);
|
||||||
const filteredComments = comments.filter(comment => comment.user.type === 'User' && comment.user.login !== actor);
|
const filteredComments = comments.filter(comment => comment.user.type === 'User' && comment.body.toLowerCase() !== staleMessage.toLowerCase());
|
||||||
issueLogger.info(`Comments not made by actor or another bot: ${logger_service_1.LoggerService.cyan(filteredComments.length)}`);
|
issueLogger.info(`Comments that are not the stale comment or another bot: ${logger_service_1.LoggerService.cyan(filteredComments.length)}`);
|
||||||
// if there are any user comments returned
|
// if there are any user comments returned
|
||||||
return filteredComments.length > 0;
|
return filteredComments.length > 0;
|
||||||
});
|
});
|
||||||
|
@ -5792,14 +5777,17 @@ ansiEscapes.iTerm = {
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 2068:
|
/***/ 2068:
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
/* module decorator */ module = __nccwpck_require__.nmd(module);
|
__nccwpck_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__
|
||||||
|
/* harmony export */ });
|
||||||
const ANSI_BACKGROUND_OFFSET = 10;
|
const ANSI_BACKGROUND_OFFSET = 10;
|
||||||
|
|
||||||
|
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
||||||
|
|
||||||
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
|
||||||
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
||||||
|
@ -5893,8 +5881,10 @@ function assembleStyles() {
|
||||||
styles.color.close = '\u001B[39m';
|
styles.color.close = '\u001B[39m';
|
||||||
styles.bgColor.close = '\u001B[49m';
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
|
styles.color.ansi = wrapAnsi16();
|
||||||
styles.color.ansi256 = wrapAnsi256();
|
styles.color.ansi256 = wrapAnsi256();
|
||||||
styles.color.ansi16m = wrapAnsi16m();
|
styles.color.ansi16m = wrapAnsi16m();
|
||||||
|
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
||||||
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
||||||
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
||||||
|
|
||||||
|
@ -5949,17 +5939,67 @@ function assembleStyles() {
|
||||||
hexToAnsi256: {
|
hexToAnsi256: {
|
||||||
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
||||||
enumerable: false
|
enumerable: false
|
||||||
|
},
|
||||||
|
ansi256ToAnsi: {
|
||||||
|
value: code => {
|
||||||
|
if (code < 8) {
|
||||||
|
return 30 + code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code < 16) {
|
||||||
|
return 90 + (code - 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
let red;
|
||||||
|
let green;
|
||||||
|
let blue;
|
||||||
|
|
||||||
|
if (code >= 232) {
|
||||||
|
red = (((code - 232) * 10) + 8) / 255;
|
||||||
|
green = red;
|
||||||
|
blue = red;
|
||||||
|
} else {
|
||||||
|
code -= 16;
|
||||||
|
|
||||||
|
const remainder = code % 36;
|
||||||
|
|
||||||
|
red = Math.floor(code / 36) / 5;
|
||||||
|
green = Math.floor(remainder / 6) / 5;
|
||||||
|
blue = (remainder % 6) / 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = Math.max(red, green, blue) * 2;
|
||||||
|
|
||||||
|
if (value === 0) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
||||||
|
|
||||||
|
if (value === 2) {
|
||||||
|
result += 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
enumerable: false
|
||||||
|
},
|
||||||
|
rgbToAnsi: {
|
||||||
|
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
||||||
|
enumerable: false
|
||||||
|
},
|
||||||
|
hexToAnsi: {
|
||||||
|
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
||||||
|
enumerable: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the export immutable
|
const ansiStyles = assembleStyles();
|
||||||
Object.defineProperty(module, 'exports', {
|
|
||||||
enumerable: true,
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ansiStyles);
|
||||||
get: assembleStyles
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -8950,8 +8990,8 @@ module.exports = require("zlib");;
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/ // Create a new module (and put it into the cache)
|
/******/ // Create a new module (and put it into the cache)
|
||||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||||
/******/ id: moduleId,
|
/******/ // no module.id needed
|
||||||
/******/ loaded: false,
|
/******/ // no module.loaded needed
|
||||||
/******/ exports: {}
|
/******/ exports: {}
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
|
@ -8964,20 +9004,36 @@ module.exports = require("zlib");;
|
||||||
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
|
||||||
/******/ module.loaded = true;
|
|
||||||
/******/
|
|
||||||
/******/ // Return the exports of the module
|
/******/ // Return the exports of the module
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/ }
|
||||||
/******/
|
/******/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ /* webpack/runtime/node module decorator */
|
/******/ /* webpack/runtime/define property getters */
|
||||||
/******/ (() => {
|
/******/ (() => {
|
||||||
/******/ __nccwpck_require__.nmd = (module) => {
|
/******/ // define getter functions for harmony exports
|
||||||
/******/ module.paths = [];
|
/******/ __nccwpck_require__.d = (exports, definition) => {
|
||||||
/******/ if (!module.children) module.children = [];
|
/******/ for(var key in definition) {
|
||||||
/******/ return module;
|
/******/ if(__nccwpck_require__.o(definition, key) && !__nccwpck_require__.o(exports, key)) {
|
||||||
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||||
|
/******/ }
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/ })();
|
||||||
|
/******/
|
||||||
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||||
|
/******/ (() => {
|
||||||
|
/******/ __nccwpck_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
|
||||||
|
/******/ })();
|
||||||
|
/******/
|
||||||
|
/******/ /* webpack/runtime/make namespace object */
|
||||||
|
/******/ (() => {
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __nccwpck_require__.r = (exports) => {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/ })();
|
/******/ })();
|
||||||
/******/
|
/******/
|
||||||
|
|
|
@ -105,7 +105,6 @@ export class IssuesProcessor {
|
||||||
async processIssues(page: Readonly<number> = 1): Promise<number> {
|
async processIssues(page: Readonly<number> = 1): Promise<number> {
|
||||||
// get the next batch of issues
|
// get the next batch of issues
|
||||||
const issues: Issue[] = await this.getIssues(page);
|
const issues: Issue[] = await this.getIssues(page);
|
||||||
const actor: string = await this.getActor();
|
|
||||||
|
|
||||||
if (issues.length <= 0) {
|
if (issues.length <= 0) {
|
||||||
this._logger.info(
|
this._logger.info(
|
||||||
|
@ -145,7 +144,6 @@ export class IssuesProcessor {
|
||||||
await issueLogger.grouping(`$$type #${issue.number}`, async () => {
|
await issueLogger.grouping(`$$type #${issue.number}`, async () => {
|
||||||
await this.processIssue(
|
await this.processIssue(
|
||||||
issue,
|
issue,
|
||||||
actor,
|
|
||||||
labelsToAddWhenUnstale,
|
labelsToAddWhenUnstale,
|
||||||
labelsToRemoveWhenUnstale
|
labelsToRemoveWhenUnstale
|
||||||
);
|
);
|
||||||
|
@ -184,7 +182,6 @@ export class IssuesProcessor {
|
||||||
|
|
||||||
async processIssue(
|
async processIssue(
|
||||||
issue: Issue,
|
issue: Issue,
|
||||||
actor: string,
|
|
||||||
labelsToAddWhenUnstale: Readonly<string>[],
|
labelsToAddWhenUnstale: Readonly<string>[],
|
||||||
labelsToRemoveWhenUnstale: Readonly<string>[]
|
labelsToRemoveWhenUnstale: Readonly<string>[]
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -455,7 +452,7 @@ export class IssuesProcessor {
|
||||||
await this._processStaleIssue(
|
await this._processStaleIssue(
|
||||||
issue,
|
issue,
|
||||||
staleLabel,
|
staleLabel,
|
||||||
actor,
|
staleMessage,
|
||||||
labelsToAddWhenUnstale,
|
labelsToAddWhenUnstale,
|
||||||
labelsToRemoveWhenUnstale,
|
labelsToRemoveWhenUnstale,
|
||||||
closeMessage,
|
closeMessage,
|
||||||
|
@ -488,20 +485,6 @@ export class IssuesProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the actor from the GitHub token or context
|
|
||||||
async getActor(): Promise<string> {
|
|
||||||
let actor;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.operations.consumeOperation();
|
|
||||||
actor = await this.client.users.getAuthenticated();
|
|
||||||
} catch (error) {
|
|
||||||
return context.actor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return actor.data.login;
|
|
||||||
}
|
|
||||||
|
|
||||||
// grab issues from github in batches of 100
|
// grab issues from github in batches of 100
|
||||||
async getIssues(page: number): Promise<Issue[]> {
|
async getIssues(page: number): Promise<Issue[]> {
|
||||||
// generate type for response
|
// generate type for response
|
||||||
|
@ -568,7 +551,7 @@ export class IssuesProcessor {
|
||||||
private async _processStaleIssue(
|
private async _processStaleIssue(
|
||||||
issue: Issue,
|
issue: Issue,
|
||||||
staleLabel: string,
|
staleLabel: string,
|
||||||
actor: string,
|
staleMessage: string,
|
||||||
labelsToAddWhenUnstale: Readonly<string>[],
|
labelsToAddWhenUnstale: Readonly<string>[],
|
||||||
labelsToRemoveWhenUnstale: Readonly<string>[],
|
labelsToRemoveWhenUnstale: Readonly<string>[],
|
||||||
closeMessage?: string,
|
closeMessage?: string,
|
||||||
|
@ -584,7 +567,7 @@ export class IssuesProcessor {
|
||||||
const issueHasComments: boolean = await this._hasCommentsSince(
|
const issueHasComments: boolean = await this._hasCommentsSince(
|
||||||
issue,
|
issue,
|
||||||
markedStaleOn,
|
markedStaleOn,
|
||||||
actor
|
staleMessage
|
||||||
);
|
);
|
||||||
issueLogger.info(
|
issueLogger.info(
|
||||||
`$$type has been commented on: ${LoggerService.cyan(issueHasComments)}`
|
`$$type has been commented on: ${LoggerService.cyan(issueHasComments)}`
|
||||||
|
@ -672,7 +655,7 @@ export class IssuesProcessor {
|
||||||
private async _hasCommentsSince(
|
private async _hasCommentsSince(
|
||||||
issue: Issue,
|
issue: Issue,
|
||||||
sinceDate: string,
|
sinceDate: string,
|
||||||
actor: string
|
staleMessage: string
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||||
|
|
||||||
|
@ -688,11 +671,13 @@ export class IssuesProcessor {
|
||||||
const comments = await this.listIssueComments(issue.number, sinceDate);
|
const comments = await this.listIssueComments(issue.number, sinceDate);
|
||||||
|
|
||||||
const filteredComments = comments.filter(
|
const filteredComments = comments.filter(
|
||||||
comment => comment.user.type === 'User' && comment.user.login !== actor
|
comment =>
|
||||||
|
comment.user.type === 'User' &&
|
||||||
|
comment.body.toLowerCase() !== staleMessage.toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
issueLogger.info(
|
issueLogger.info(
|
||||||
`Comments not made by actor or another bot: ${LoggerService.cyan(
|
`Comments that are not the stale comment or another bot: ${LoggerService.cyan(
|
||||||
filteredComments.length
|
filteredComments.length
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,4 +2,5 @@ import {IUser} from './user';
|
||||||
|
|
||||||
export interface IComment {
|
export interface IComment {
|
||||||
user: IUser;
|
user: IUser;
|
||||||
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue