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-18 10:20:33 -0400
committerGitHub <noreply@github.com>2020-06-18 10:20:33 -0400
commitb8cb77a290d6bf1500962ef3fdb92249d45b0ac6 (patch)
tree456f207b7d487d1414c5d954dac17ce0d33789ca /src/git-source-provider.ts
parent33f740f1eb34a02546c9a2eb2d6a725d7c67ca92 (diff)
fix default branch for .wiki and when using ssh (#284)
Diffstat (limited to 'src/git-source-provider.ts')
-rw-r--r--src/git-source-provider.ts26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts
index 25fba04..366ff33 100644
--- a/src/git-source-provider.ts
+++ b/src/git-source-provider.ts
@@ -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()