()
| 17 | ]; |
| 18 | |
| 19 | async function main() { |
| 20 | const github = new Octokit({auth: await getAuthTokenFor(ANGULAR_ROBOT)}); |
| 21 | |
| 22 | try { |
| 23 | /** The pull request triggering the event */ |
| 24 | const pullRequest = await PullRequest.get(github); |
| 25 | /** The results of the validation functions, organized by validation result state. */ |
| 26 | const validationResultByState: ValidationResults = { |
| 27 | pending: [], |
| 28 | success: [], |
| 29 | failure: [], |
| 30 | }; |
| 31 | |
| 32 | // Run all of the validators and sort the results. |
| 33 | validators.forEach((validator) => { |
| 34 | const result = validator(pullRequest); |
| 35 | validationResultByState[result.state].push(result); |
| 36 | }); |
| 37 | |
| 38 | await pullRequest.setCheckResult(buildCheckResultOutput(validationResultByState, pullRequest)); |
| 39 | } finally { |
| 40 | await revokeActiveInstallationToken(github); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | main().catch((err) => { |
| 45 | console.error(err); |
no test coverage detected