mirror of
https://code.forgejo.org/actions/checkout
synced 2025-04-29 20:14:26 +08:00
.
This commit is contained in:
parent
ad6dd29a96
commit
4af80cb867
4 changed files with 68 additions and 68 deletions
24
src/github-api-helper.ts
Normal file
24
src/github-api-helper.ts
Normal file
|
@ -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)}`)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue