Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/git-source-provider.ts
diff options
context:
space:
mode:
authoreric sciple <ericsciple@users.noreply.github.com>2020-06-16 13:41:01 -0400
committerGitHub <noreply@github.com>2020-06-16 13:41:01 -0400
commit17570e7adbcebf582c615bdac7f07339940d90e3 (patch)
tree0db6cfd9a09a1bc192bd7f4238f68a627fadd348 /src/git-source-provider.ts
parent7edd89f0f18ec3de28305003df3cccc46e4c60c9 (diff)
determine default branch (#278)
Diffstat (limited to 'src/git-source-provider.ts')
-rw-r--r--src/git-source-provider.ts11
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)