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EAAE;gCACN,WAAW,aAAA;gCACX,KAAK,OAAA;gCACL,OAAO,SAAA;6BACR;yBACK,CAAC,EAAA;;oBATT,SASS,CAAC;oBACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,+BAA6B,WAAW,CAAC,MAAM,MAAG,CAAC,CAAC;;;;oBAErE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;oBAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAC,CAAC,CAAC;oBACrB,MAAM,GAAC,CAAC;;;;;CAEX;AA9BD,kCA8BC;AAED,SAAsB,QAAQ,CAAC,EAQ9B;QAPC,oBAAO,EACP,YAAG,EACH,0BAAU;;;;;;;oBAOR,qBAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;4BAC3B,OAAO,SAAA;4BACP,GAAG,KAAA;4BACH,UAAU,YAAA;4BACV,MAAM,EAAE,OAAO;4BACf,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BACtC,MAAM,EAAE,mBAAW,CAAC,SAAS;yBACvB,CAAC,EAAA;;oBAPT,SAOS,CAAC;oBACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;;;;oBAE1C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAC,CAAC,CAAC;oBACrB,MAAM,GAAC,CAAC;;;;;CAEX;AAxBD,4BAwBC","sourcesContent":["import {Context} from 'probot';\n\nimport {CheckStatus, Annotation, CheckConclusion} from './types';\n\nconst headers = {accept: 'application/vnd.github.antiope-preview+json'};\n\nexport async function start({\n context,\n owner,\n repo,\n sha,\n}: {\n sha: string;\n context: Context;\n owner: string;\n repo: string;\n}): Promise<string> {\n const id = `${owner}/${repo}#${sha}`;\n try {\n const result = await context.github.request({\n headers,\n method: 'POST',\n url: `https://api.github.com/repos/${owner}/${repo}/check-runs`,\n name: 'graphql-inspector',\n started_at: new Date().toISOString(),\n head_sha: sha,\n status: CheckStatus.InProgress,\n } as any);\n context.log.info(`[check-start] sent - ${id}`);\n\n return result.data.url;\n } catch (e) {\n context.log.error(`[check-start] failed - ${id}`);\n context.log.error(e);\n throw e;\n }\n}\n\nexport async function annotations({\n context,\n url,\n annotations,\n title,\n summary,\n}: {\n url: string;\n annotations: Annotation[];\n context: Context;\n title: string;\n summary: string;\n}) {\n try {\n await context.github.request({\n headers,\n url,\n method: 'PATCH',\n output: {\n annotations,\n title,\n summary,\n },\n } as any);\n context.log.info(`[check-annotations] sent (${annotations.length})`);\n } catch (e) {\n context.log.error(`[check-annotations] failed`);\n context.log.error(e);\n throw e;\n }\n}\n\nexport async function complete({\n context,\n url,\n conclusion,\n}: {\n url: string;\n context: Context;\n conclusion: CheckConclusion;\n}) {\n try {\n await context.github.request({\n headers,\n url,\n conclusion,\n method: 'PATCH',\n completed_at: new Date().toISOString(),\n status: CheckStatus.Completed,\n } as any);\n context.log.info(`[check-complete] sent`);\n } catch (e) {\n context.log.error(`[check-complete] failed`);\n context.log.error(e);\n throw e;\n }\n}\n"]}
\No newline at end of file