mirror of
https://github.com/actions/checkout.git
synced 2025-04-20 01:26:46 +00:00
fix default branch for .wiki and when using ssh (#284)
This commit is contained in:
parent
b4483adec3
commit
fb6f360df2
6 changed files with 126 additions and 29 deletions
|
@ -19,17 +19,6 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
)
|
||||
const repositoryUrl = urlHelper.getFetchUrl(settings)
|
||||
|
||||
// Determine the default branch
|
||||
if (!settings.ref && !settings.commit) {
|
||||
core.startGroup('Determining the default branch')
|
||||
settings.ref = await githubApiHelper.getDefaultBranch(
|
||||
settings.authToken,
|
||||
settings.repositoryOwner,
|
||||
settings.repositoryName
|
||||
)
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
// Remove conflicting file path
|
||||
if (fsHelper.fileExistsSync(settings.repositoryPath)) {
|
||||
await io.rmRF(settings.repositoryPath)
|
||||
|
@ -114,6 +103,21 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
await authHelper.configureAuth()
|
||||
core.endGroup()
|
||||
|
||||
// Determine the default branch
|
||||
if (!settings.ref && !settings.commit) {
|
||||
core.startGroup('Determining the default branch')
|
||||
if (settings.sshKey) {
|
||||
settings.ref = await git.getDefaultBranch(repositoryUrl)
|
||||
} else {
|
||||
settings.ref = await githubApiHelper.getDefaultBranch(
|
||||
settings.authToken,
|
||||
settings.repositoryOwner,
|
||||
settings.repositoryName
|
||||
)
|
||||
}
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
// LFS install
|
||||
if (settings.lfs) {
|
||||
await git.lfsInstall()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue