Skip to content

Commit

Permalink
Get repo url with token
Browse files Browse the repository at this point in the history
  • Loading branch information
arielj committed Dec 1, 2021
1 parent d2309ad commit 552a52e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9199,7 +9199,8 @@ function run() {
core.error("Couldn't connect to GitHub, make sure the GITHUB_TOKEN is a valid token");
return;
}
const source_url = octokit.rest.repos.downloadTarballArchive({
const { url } = yield octokit.rest.repos.downloadTarballArchive({
method: "HEAD",
owner: issue.owner,
repo: issue.repo,
ref: branch,
Expand All @@ -9210,7 +9211,7 @@ function run() {
branch,
pipeline,
source_blob: {
url: source_url,
url,
version,
},
pr_number,
Expand All @@ -9220,7 +9221,7 @@ function run() {
branch,
pipeline,
source_blob: {
url: source_url,
url,
version,
},
pr_number,
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ interface ReviewApp {
id: number;
}

interface TarballResponse {
status: number;
url: string;
}

async function run() {
core.debug(JSON.stringify(github.context));

Expand Down Expand Up @@ -78,11 +83,13 @@ async function run() {
return;
}

const source_url = octokit.rest.repos.downloadTarballArchive({
owner: issue.owner,
repo: issue.repo,
ref: branch,
});
const { url }: TarballResponse =
await octokit.rest.repos.downloadTarballArchive({
method: "HEAD",
owner: issue.owner,
repo: issue.repo,
ref: branch,
});

try {
core.info("Creating Review App");
Expand All @@ -91,7 +98,7 @@ async function run() {
branch,
pipeline,
source_blob: {
url: source_url,
url,
version,
},
pr_number,
Expand All @@ -102,7 +109,7 @@ async function run() {
branch,
pipeline,
source_blob: {
url: source_url,
url,
version,
},
pr_number,
Expand Down

0 comments on commit 552a52e

Please sign in to comment.