Skip to content

Commit

Permalink
getPatch: use githubToken to download the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Nov 21, 2024
1 parent b350f9f commit 3ccd30a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/getPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export default async function getPatch ({
github = new Octokit({ auth: githubToken })
}

if (!githubToken) {
githubToken = process.env.GITHUB_TOKEN
}

if (debug) { console.log(`getPatch ${owner} ${repo} ${prnum}`) }

let patchBody = null
Expand Down Expand Up @@ -59,10 +63,9 @@ export default async function getPatch ({
})

// clone the repo
const cloneUrl = `git@github.com:${owner}/${repo}.git`
const cloneUrl = `https://${githubToken}@github.com/${owner}/${repo}.git`
const clonePath = path.join(os.tmpdir(), `pr-${prnum}`)

console.log(`Cloning ${cloneUrl} to ${clonePath}, manually`)
execSync(`git clone ${cloneUrl} ${clonePath}`)

// save current directory
Expand Down

0 comments on commit 3ccd30a

Please sign in to comment.