From bd81986b0f0aed2710334e654db6bfff0f4b2dea Mon Sep 17 00:00:00 2001 From: Nikola Bogetic Date: Mon, 22 Jul 2024 20:55:31 -0400 Subject: [PATCH] Revert "chore: Update octokit API usage to use "rest" namespace" --- lib/action.js | 2 +- lib/action.test.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/action.js b/lib/action.js index 3f89306..1df8d05 100644 --- a/lib/action.js +++ b/lib/action.js @@ -61,7 +61,7 @@ module.exports = async function (context) { for (let check of shortcutChecks) { console.log(`Updating ${check.id} check to neutral status`); - await octokit.rest.checks.update({ + await octokit.checks.update({ ...repoInfo, check_run_id: check.id, conclusion: 'neutral' diff --git a/lib/action.test.js b/lib/action.test.js index b5be563..9a92517 100644 --- a/lib/action.test.js +++ b/lib/action.test.js @@ -234,9 +234,9 @@ describe('pr-lint-action', () => { await action(context, api); - expect(api.rest.checks.update).toHaveBeenCalledTimes(2); + expect(api.checks.update).toHaveBeenCalledTimes(2); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, { + expect(api.checks.update).toHaveBeenNthCalledWith(1, { check_run_id: 2, owner: 'movableink', repo: 'pr-shortcut-lint-action-test', @@ -244,7 +244,7 @@ describe('pr-lint-action', () => { conclusion: 'neutral' }); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, { + expect(api.checks.update).toHaveBeenNthCalledWith(2, { check_run_id: 3, owner: 'movableink', repo: 'pr-shortcut-lint-action-test', @@ -260,9 +260,9 @@ describe('pr-lint-action', () => { await action(context, api); - expect(api.rest.checks.update).toHaveBeenCalledTimes(2); + expect(api.checks.update).toHaveBeenCalledTimes(2); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, { + expect(api.checks.update).toHaveBeenNthCalledWith(1, { check_run_id: 2, owner: 'movableink', repo: 'pr-shortcut-lint-action-test', @@ -270,7 +270,7 @@ describe('pr-lint-action', () => { conclusion: 'neutral' }); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, { + expect(api.checks.update).toHaveBeenNthCalledWith(2, { check_run_id: 3, owner: 'movableink', repo: 'pr-shortcut-lint-action-test', @@ -285,9 +285,9 @@ describe('pr-lint-action', () => { await action(context, api); - expect(api.rest.checks.update).toHaveBeenCalledTimes(2); + expect(api.checks.update).toHaveBeenCalledTimes(2); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, { + expect(api.checks.update).toHaveBeenNthCalledWith(1, { check_run_id: 2, owner: 'movableink', repo: 'pr-shortcut-lint-action-test', @@ -295,7 +295,7 @@ describe('pr-lint-action', () => { conclusion: 'neutral' }); - expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, { + expect(api.checks.update).toHaveBeenNthCalledWith(2, { check_run_id: 3, owner: 'movableink', repo: 'pr-shortcut-lint-action-test',