MCPcopy Create free account
hub / github.com/serverless/examples / githubCheck

Function githubCheck

aws-node-github-check/handler.js:6–18  ·  view source on GitHub ↗
(event, context, callback)

Source from the content-addressed store, hash-verified

4
5/* eslint-disable import/prefer-default-export */
6export 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}

Callers

nothing calls this directly

Calls 7

eventIsAPullRequestFunction · 0.90
successFunction · 0.90
isAValidPullRequestFunction · 0.90
githubSuccessPayloadFunction · 0.90
githubFailurePayloadFunction · 0.90
updatePullRequestStatusFunction · 0.90
failureFunction · 0.90

Tested by

no test coverage detected