diff options
| author | eric sciple <ericsciple@users.noreply.github.com> | 2020-06-16 13:41:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-16 13:41:01 -0400 |
| commit | 17570e7adbcebf582c615bdac7f07339940d90e3 (patch) | |
| tree | 0db6cfd9a09a1bc192bd7f4238f68a627fadd348 /src/git-source-provider.ts | |
| parent | 7edd89f0f18ec3de28305003df3cccc46e4c60c9 (diff) | |
determine default branch (#278)
Diffstat (limited to 'src/git-source-provider.ts')
| -rw-r--r-- | src/git-source-provider.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index 89c16b5..25fba04 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -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) |
