mirror of
https://forgejo.mixinet.net/actions/checkout.git
synced 2025-06-15 14:50:45 -06:00
add support for gist.github.com
This commit is contained in:
parent
aabbfeb2ce
commit
ec00d65c65
9 changed files with 69 additions and 16 deletions
|
@ -16,10 +16,17 @@ export function getInputs(): IGitSourceSettings {
|
|||
core.debug(`GITHUB_WORKSPACE = '${githubWorkspacePath}'`)
|
||||
fsHelper.directoryExistsSync(githubWorkspacePath, true)
|
||||
|
||||
// Gist repository?
|
||||
result.isGist = !!core.getInput('gist') || false
|
||||
core.debug(`isGist = '${result.isGist}'`)
|
||||
|
||||
// Qualified repository
|
||||
const qualifiedRepository =
|
||||
let qualifiedRepository =
|
||||
core.getInput('repository') ||
|
||||
`${github.context.repo.owner}/${github.context.repo.repo}`
|
||||
if (result.isGist) {
|
||||
qualifiedRepository = core.getInput('gist')
|
||||
}
|
||||
core.debug(`qualified repository = '${qualifiedRepository}'`)
|
||||
const splitRepository = qualifiedRepository.split('/')
|
||||
if (
|
||||
|
@ -27,8 +34,9 @@ export function getInputs(): IGitSourceSettings {
|
|||
!splitRepository[0] ||
|
||||
!splitRepository[1]
|
||||
) {
|
||||
const model = result.isGist ? 'gist' : 'repository'
|
||||
throw new Error(
|
||||
`Invalid repository '${qualifiedRepository}'. Expected format {owner}/{repo}.`
|
||||
`Invalid ${model} '${qualifiedRepository}'. Expected format {owner}/{repo}.`
|
||||
)
|
||||
}
|
||||
result.repositoryOwner = splitRepository[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue