feat(assignees): add 6 new options to avoid stale for assignees (#327)

* feat(assignees): add new option to avoid stale for assignees

closes #271

* test: add more coverage

* docs: fix readme format issue

* docs: reorder and enhance typo

* docs(contributing): add more information about the npm scripts
This commit is contained in:
Geoffrey Testelin
2021-02-28 12:15:08 +01:00
committed by GitHub
parent 996798eb71
commit ec96ff65b0
24 changed files with 2021 additions and 244 deletions

View File

@@ -0,0 +1,19 @@
import {IIssue} from '../../src/interfaces/issue';
export function generateIIssue(
partialIssue?: Readonly<Partial<IIssue>>
): IIssue {
return {
milestone: undefined,
assignees: [],
labels: [],
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
number: Math.round(Math.random() * 5000),
pull_request: null,
title: 'dummy-title',
locked: false,
state: 'dummy-state',
...partialIssue
};
}

View File

@@ -1,4 +1,5 @@
import {Issue} from '../../src/classes/issue';
import {IAssignee} from '../../src/interfaces/assignee';
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
import {IsoDateString} from '../../src/types/iso-date-string';
@@ -12,7 +13,8 @@ export function generateIssue(
labels: string[] = [],
isClosed = false,
isLocked = false,
milestone: string | undefined = undefined
milestone: string | undefined = undefined,
assignees: string[] = []
): Issue {
return new Issue(options, {
number: id,
@@ -29,6 +31,13 @@ export function generateIssue(
? {
title: milestone
}
: undefined
: undefined,
assignees: assignees.map(
(assignee: Readonly<string>): IAssignee => {
return {
login: assignee
};
}
)
});
}