Merge pull request #23 from microsoft/run_repros
Adds the ability to run repros instantly after they have been added
This commit is contained in:
Коммит
9972b11b5c
|
@ -56,7 +56,8 @@ describe(addReprosLabelOnComments, () => {
|
|||
|
||||
await addReprosLabelOnComments(api, payload, getFakeLogger())
|
||||
|
||||
expect(mockAPI.issues.addLabels).not.toHaveBeenCalledWith()
|
||||
expect(mockAPI.issues.addLabels).not.toHaveBeenCalled()
|
||||
expect(mockAPI.repos.createDispatchEvent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("NO-OPs when there are no labels already ", async () => {
|
||||
|
@ -68,6 +69,7 @@ describe(addReprosLabelOnComments, () => {
|
|||
await addReprosLabelOnComments(api, payload, getFakeLogger())
|
||||
|
||||
expect(mockAPI.issues.addLabels).not.toHaveBeenCalledWith()
|
||||
expect(mockAPI.repos.createDispatchEvent).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("Adds the label when it has a repro in the body and there are labels already", async () => {
|
||||
|
@ -84,6 +86,7 @@ describe(addReprosLabelOnComments, () => {
|
|||
owner: "microsoft",
|
||||
repo: "TypeScript-Website",
|
||||
})
|
||||
expect(mockAPI.repos.createDispatchEvent).toHaveBeenCalled()
|
||||
expect(pingDiscord).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ export const addReprosLabelOnIssue = async (api: Octokit, payload: WebhookPayloa
|
|||
if (issue.labels.find(l => l.name === "Repro Requested")) {
|
||||
await api.issues.removeLabel({ ...thisIssue, name: "Repro Requested" })
|
||||
}
|
||||
|
||||
// Trigger a run of all repros
|
||||
api.repos.createDispatchEvent({ ...thisIssue, event_type: "run-twoslash-repros" })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,5 +91,8 @@ export const addReprosLabelOnComments = async (
|
|||
if (issue.labels.find(l => l.name === "Repro Requested")) {
|
||||
await api.issues.removeLabel({ ...thisIssue, name: "Repro Requested" })
|
||||
}
|
||||
|
||||
// Trigger a run of all repros
|
||||
api.repos.createDispatchEvent({ ...thisIssue, event_type: "run-twoslash-repros" })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ export const createMockGitHubClient = () => {
|
|||
checkCollaborator: jest.fn(),
|
||||
getContents: jest.fn(),
|
||||
getCombinedStatusForRef: jest.fn(),
|
||||
createDispatchEvent: jest.fn()
|
||||
},
|
||||
issues: {
|
||||
addAssignees: jest.fn(),
|
||||
|
@ -82,6 +83,7 @@ export const createFakeGitHubClient = () => {
|
|||
checkCollaborator: Promise.resolve({}),
|
||||
getContents: Promise.resolve({}),
|
||||
getCombinedStatusForRef: Promise.resolve({}),
|
||||
createDispatchEvent: Promise.resolve({}),
|
||||
},
|
||||
issues: {
|
||||
addAssignees: Promise.resolve({}),
|
||||
|
|
Загрузка…
Ссылка в новой задаче