using ref and promise data

This commit is contained in:
Naveenraj M
2020-03-29 17:22:16 +05:30
parent 732adc41ef
commit 98f4d25d9b
4 changed files with 16 additions and 12 deletions

View File

@ -16,16 +16,18 @@ function download_archive(owner, repo, ref) {
try {
const octokit = new Octokit();
const archive_format = "tarball";
const downloadLocation = octokit.repos.getArchiveLink({
octokit.repos.getArchiveLink({
owner,
repo,
archive_format,
ref
}).then(({ data }) => {
console.log(data);
});
console.log(`Download Location : ${downloadLocation}`);
const tarBallPath = yield tc.downloadTool(downloadLocation);
console.log(`Tarball Location : ${tarBallPath}`);
return tarBallPath;
//console.log(`Download Location : ${downloadLocation}`);
//const tarBallPath = await tc.downloadTool(downloadLocation);
//console.log(`Tarball Location : ${tarBallPath}`);
//return tarBallPath;
}
catch (error) {
core.setFailed(error.message);

View File

@ -20,7 +20,7 @@ function run() {
const context = github.context;
const owner = context.repo.owner;
const repo = context.repo.repo;
const ref = context.repo.ref;
const ref = context.ref;
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
const tarBallPath = download_tar(owner, repo, ref);
console.log(`Tar Path for copy : ${tarBallPath}`);

View File

@ -10,20 +10,22 @@ async function download_archive(owner, repo, ref ) {
const archive_format = "tarball";
const downloadLocation = octokit.repos.getArchiveLink({
octokit.repos.getArchiveLink({
owner,
repo,
archive_format,
ref
}).then(( { data }) => {
console.log(data)
});
console.log(`Download Location : ${downloadLocation}`);
//console.log(`Download Location : ${downloadLocation}`);
const tarBallPath = await tc.downloadTool(downloadLocation);
//const tarBallPath = await tc.downloadTool(downloadLocation);
console.log(`Tarball Location : ${tarBallPath}`);
//console.log(`Tarball Location : ${tarBallPath}`);
return tarBallPath;
//return tarBallPath;
} catch (error) {
core.setFailed(error.message);

View File

@ -12,7 +12,7 @@ async function run() {
const owner = context.repo.owner
const repo = context.repo.repo
const ref = context.repo.ref
const ref = context.ref
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);