From 1c5fc49e9e9c437db7d9f1d5ef9214547f23d301 Mon Sep 17 00:00:00 2001 From: Naveenraj M Date: Sun, 29 Mar 2020 20:55:40 +0530 Subject: [PATCH] await API call --- lib/download-release-archive.js | 2 +- src/download-release-archive.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/download-release-archive.js b/lib/download-release-archive.js index bad95b0..4f86e1d 100644 --- a/lib/download-release-archive.js +++ b/lib/download-release-archive.js @@ -19,7 +19,7 @@ function download_archive(owner, repo, ref) { const tag = "v1.0.0"; const tarFile = `${tag}.tar.gz`; console.log("Calling API ..."); - octokit.repos.getArchiveLink({ + yield octokit.repos.getArchiveLink({ owner, repo, archive_format, diff --git a/src/download-release-archive.ts b/src/download-release-archive.ts index 10f6f68..be83ea9 100644 --- a/src/download-release-archive.ts +++ b/src/download-release-archive.ts @@ -15,13 +15,13 @@ async function download_archive(owner, repo, ref ) { const tarFile = `${tag}.tar.gz`; console.log("Calling API ..."); - octokit.repos.getArchiveLink({ + await octokit.repos.getArchiveLink({ owner, repo, archive_format, ref }).then(( { data }) => { - fs.writeFile(tarFile, Buffer.from(data), function(err){ + fs.writeFile(tarFile, Buffer.from(data), function(err){ if(err) { return console.log(err); }