Skip to content

Commit

Permalink
chore: Update octokit API usage to use "rest" namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolabogetic committed Jul 23, 2024
1 parent 6708744 commit c5697be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.checks.update({
await octokit.rest.checks.update({
...repoInfo,
check_run_id: check.id,
conclusion: 'neutral'
Expand Down
18 changes: 9 additions & 9 deletions lib/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,17 @@ describe('pr-lint-action', () => {

await action(context, api);

expect(api.checks.update).toHaveBeenCalledTimes(2);
expect(api.rest.checks.update).toHaveBeenCalledTimes(2);

expect(api.checks.update).toHaveBeenNthCalledWith(1, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, {
check_run_id: 2,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
ref: 'fix_things',
conclusion: 'neutral'
});

expect(api.checks.update).toHaveBeenNthCalledWith(2, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, {
check_run_id: 3,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
Expand All @@ -260,17 +260,17 @@ describe('pr-lint-action', () => {

await action(context, api);

expect(api.checks.update).toHaveBeenCalledTimes(2);
expect(api.rest.checks.update).toHaveBeenCalledTimes(2);

expect(api.checks.update).toHaveBeenNthCalledWith(1, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, {
check_run_id: 2,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
ref: 'fix_things',
conclusion: 'neutral'
});

expect(api.checks.update).toHaveBeenNthCalledWith(2, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, {
check_run_id: 3,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
Expand All @@ -285,17 +285,17 @@ describe('pr-lint-action', () => {

await action(context, api);

expect(api.checks.update).toHaveBeenCalledTimes(2);
expect(api.rest.checks.update).toHaveBeenCalledTimes(2);

expect(api.checks.update).toHaveBeenNthCalledWith(1, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(1, {
check_run_id: 2,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
ref: 'fix_things',
conclusion: 'neutral'
});

expect(api.checks.update).toHaveBeenNthCalledWith(2, {
expect(api.rest.checks.update).toHaveBeenNthCalledWith(2, {
check_run_id: 3,
owner: 'movableink',
repo: 'pr-shortcut-lint-action-test',
Expand Down

0 comments on commit c5697be

Please sign in to comment.