Skip to content

Commit

Permalink
Fix octokit for v5 (#14)
Browse files Browse the repository at this point in the history
* Fix octokit for v5

* Fix tests and ncc
  • Loading branch information
airadier authored Jul 8, 2021
1 parent 39a386f commit 1ce9a32
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ async function generateChecks(scanResult, evaluationResults, vulnerabilities) {
}

try {
check_run = await octokit.checks.create({
check_run = await octokit.rest.checks.create({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
name: "Scan results",
Expand All @@ -429,7 +429,7 @@ async function generateChecks(scanResult, evaluationResults, vulnerabilities) {

try {
for (let i = 50; i < annotations.length; i+=50) {
await octokit.checks.update({
await octokit.rest.checks.update({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
check_run_id: check_run.data.id,
Expand Down
32 changes: 19 additions & 13 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,11 @@ describe("process scan results", () => {

github.getOctokit = jest.fn(() => {
return {
checks: {
create: async function (receivedData) {
data = receivedData;
rest: {
checks: {
create: async function (receivedData) {
data = receivedData;
}
}
}
}
Expand Down Expand Up @@ -376,9 +378,11 @@ describe("process scan results", () => {

github.getOctokit = jest.fn(() => {
return {
checks: {
create: async function (receivedData) {
data = receivedData;
rest: {
checks: {
create: async function (receivedData) {
data = receivedData;
}
}
}
}
Expand Down Expand Up @@ -408,13 +412,15 @@ describe("process scan results", () => {

github.getOctokit = jest.fn(() => {
return {
checks: {
create: async function (receivedData) {
createData = receivedData;
return { data: {id: 1 } };
},
update: async function (receivedData) {
updateData = receivedData;
rest: {
checks: {
create: async function (receivedData) {
createData = receivedData;
return { data: {id: 1 } };
},
update: async function (receivedData) {
updateData = receivedData;
}
}
}
}
Expand Down

0 comments on commit 1ce9a32

Please sign in to comment.