Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/github-api-helper.ts
diff options
context:
space:
mode:
authoreric sciple <ericsciple@users.noreply.github.com>2019-12-09 17:01:19 -0500
committereric sciple <ericsciple@users.noreply.github.com>2019-12-09 17:01:19 -0500
commitb750541d2b898eda75e8a36fbee698c9c1978599 (patch)
tree35ce09dc3b3a84157dcca9813f64c3413cf176e4 /src/github-api-helper.ts
parenta3220f27da78ca8871a517f4c808a739a436833f (diff)
.
Diffstat (limited to 'src/github-api-helper.ts')
-rw-r--r--src/github-api-helper.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/github-api-helper.ts b/src/github-api-helper.ts
new file mode 100644
index 0000000..3da0154
--- /dev/null
+++ b/src/github-api-helper.ts
@@ -0,0 +1,24 @@
+import * as github from '@actions/github'
+import {ReposGetArchiveLinkParams} from '@octokit/rest'
+
+const IS_WINDOWS = process.platform === 'win32'
+
+export async function downloadRepository(
+ accessToken: string,
+ owner: string,
+ repo: string,
+ ref: string,
+ repositoryPath: string
+): Promise<void> {
+ const octokit = new github.GitHub(accessToken)
+ const params: ReposGetArchiveLinkParams = {
+ archive_format: IS_WINDOWS ? 'zipball' : 'tarball',
+ owner: owner,
+ repo: repo,
+ ref: ref
+ }
+ const response = await octokit.repos.getArchiveLink(params)
+ console.log(`status=${response.status}`)
+ console.log(`headers=${JSON.stringify(response.headers)}`)
+ console.log(`data=${JSON.stringify(typeof response.data)}`)
+}