Skip to content

Commit

Permalink
fix: try mark as failure without annotations when the GitHub API fails (
Browse files Browse the repository at this point in the history
#64)

Normally this means we send invalid annotations, so let's just send a
failure without them.

E.g. electron/electron#15541
  • Loading branch information
MarshallOfSound committed Nov 3, 2018
1 parent 194273a commit 7fe7d2b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/backport/utils.ts
Expand Up @@ -344,8 +344,8 @@ export const backportImpl = async (robot: Application,
const checkRun = await getCheckRun();
if (checkRun) {
const mdSep = '``````````````````````````````';
context.github.checks.update(context.repo({
check_run_id: `${checkRun.id}`,
const updateOpts: GitHub.ChecksUpdateParams = context.repo({
check_run_id: checkRun.id,
name: checkRun.name,
conclusion: 'failure' as 'failure',
completed_at: (new Date()).toISOString(),
Expand All @@ -355,7 +355,14 @@ export const backportImpl = async (robot: Application,
text: diff ? `Failed Diff:\n\n${mdSep}diff\n${rawDiff}\n${mdSep}` : undefined,
annotations: annotations ? annotations : undefined,
},
}));
});
try {
await context.github.checks.update(updateOpts as any);
} catch (err) {
// A github error occurred, let's try mark it as a failure without annotations
updateOpts.output!.annotations = undefined;
await context.github.checks.update(updateOpts as any);
}
}
}
},
Expand Down

0 comments on commit 7fe7d2b

Please sign in to comment.