mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 04:13:50 +00:00
added file download-release-archive.ts
This commit is contained in:
33
src/download-release-archive.ts
Normal file
33
src/download-release-archive.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const { Octokit } = require('@octokit/rest');
|
||||||
|
const fs = require('fs');
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
|
|
||||||
|
async function download_archive(owner, repo, ref ) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
const octokit = new Octokit();
|
||||||
|
|
||||||
|
const archive_format = "tarball";
|
||||||
|
|
||||||
|
const downloadLocation = octokit.repos.getArchiveLink({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
archive_format,
|
||||||
|
ref
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Download Location : ${downloadLocation}`);
|
||||||
|
|
||||||
|
const tarBallPath = await tc.downloadTool(downloadLocation);
|
||||||
|
|
||||||
|
console.log(`Tarball Location : ${tarBallPath}`);
|
||||||
|
|
||||||
|
return tarBallPath;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = download_archive;
|
Reference in New Issue
Block a user