mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-27 14:29:54 +02:00
determine default branch (#278)
This commit is contained in:
parent
453ee27fca
commit
00a3be8934
7 changed files with 78 additions and 18 deletions
|
@ -19,6 +19,17 @@ 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue