From 17570e7adbcebf582c615bdac7f07339940d90e3 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Tue, 16 Jun 2020 13:41:01 -0400 Subject: determine default branch (#278) --- src/git-source-provider.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/git-source-provider.ts') 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 { ) 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) -- cgit v1.2.3