(event, context, callback)
| 4 | |
| 5 | /* eslint-disable import/prefer-default-export */ |
| 6 | export async function githubCheck(event, context, callback) { |
| 7 | const githubClient = client(process.env.GITHUB_TOKEN); |
| 8 | |
| 9 | const body = JSON.parse(event.body); |
| 10 | if (!eventIsAPullRequest(body)) return callback(null, success('Event is not a Pull Request')); |
| 11 | const payload = isAValidPullRequest(body) ? githubSuccessPayload() : githubFailurePayload(); |
| 12 | try { |
| 13 | await updatePullRequestStatus(githubClient, payload, body.repository, body.pull_request); |
| 14 | return callback(null, success(`Process finished with state: ${payload.state}`)); |
| 15 | } catch (e) { |
| 16 | return callback(null, failure('Process finished with error')); |
| 17 | } |
| 18 | } |
nothing calls this directly
no test coverage detected