Skip to content

Commit

Permalink
fix: update octokit to use rest
Browse files Browse the repository at this point in the history
  • Loading branch information
TreTuna committed Oct 12, 2021
1 parent 619327f commit ea58ab6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ async function run() {

const octokit = new github.getOctokit(githubToken);

const { data: currentPulls } = await octokit.pulls.list({ owner, repo });
const { data: currentPulls } = await octokit.rest.pulls.list({
owner,
repo,
});

const currentPull = currentPulls.find((pull) => {
return pull.head.ref === fromBranch && pull.base.ref === toBranch;
Expand All @@ -320,7 +323,7 @@ async function run() {
}

if (shouldCreatePullRequest) {
const { data: pullRequest } = await octokit.pulls.create({
const { data: pullRequest } = await octokit.rest.pulls.create({
owner,
repo,
head: fromBranch,
Expand Down Expand Up @@ -370,7 +373,7 @@ async function run() {
}

async function hasContentDifference(octokit, fromBranch, toBranch) {
const { data: response } = await octokit.repos.compareCommits({
const { data: response } = await octokit.rest.repos.compareCommits({
owner,
repo,
base: toBranch,
Expand Down
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ async function run() {

const octokit = new github.getOctokit(githubToken);

const { data: currentPulls } = await octokit.pulls.list({ owner, repo });
const { data: currentPulls } = await octokit.rest.pulls.list({
owner,
repo,
});

const currentPull = currentPulls.find((pull) => {
return pull.head.ref === fromBranch && pull.base.ref === toBranch;
Expand All @@ -40,7 +43,7 @@ async function run() {
}

if (shouldCreatePullRequest) {
const { data: pullRequest } = await octokit.pulls.create({
const { data: pullRequest } = await octokit.rest.pulls.create({
owner,
repo,
head: fromBranch,
Expand Down Expand Up @@ -90,7 +93,7 @@ async function run() {
}

async function hasContentDifference(octokit, fromBranch, toBranch) {
const { data: response } = await octokit.repos.compareCommits({
const { data: response } = await octokit.rest.repos.compareCommits({
owner,
repo,
base: toBranch,
Expand Down

0 comments on commit ea58ab6

Please sign in to comment.