Skip to content

Commit

Permalink
fix: correct data shape for octokit.checks.update call (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Aug 9, 2023
1 parent be709b4 commit 2fbfbf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
5 changes: 4 additions & 1 deletion spec/api-review-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@ describe('api review', () => {
const expected = {
name: API_REVIEW_CHECK_NAME,
status: 'completed',
title: 'PR no longer requires API Review',
output: {
title: 'Outdated',
summary: 'PR no longer requires API Review',
},
conclusion: CheckRunStatus.NEUTRAL,
};

Expand Down
23 changes: 14 additions & 9 deletions src/api-review-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,20 @@ export async function addOrUpdateAPIReviewCheck(octokit: Context['octokit'], pr:

const resetToNeutral = async () => {
if (!checkRun) return;
return await octokit.checks.update({
owner,
repo,
name: API_REVIEW_CHECK_NAME,
status: 'completed',
title: 'PR no longer requires API Review',
check_run_id: checkRun.id,
conclusion: CheckRunStatus.NEUTRAL,
});
const params: Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters'] =
{
owner,
repo,
name: API_REVIEW_CHECK_NAME,
status: 'completed',
output: {
title: 'Outdated',
summary: 'PR no longer requires API Review',
},
check_run_id: checkRun.id,
conclusion: CheckRunStatus.NEUTRAL,
};
return await octokit.checks.update(params);
};

// We do not care about PRs without an API review label of any kind.
Expand Down

0 comments on commit 2fbfbf7

Please sign in to comment.