Gitversion: GitHub Actions build fails with private GitHub repo and Dependabot PR

Created on 20 Feb 2020  ·  13Comments  ·  Source: GitTools/GitVersion

I've never had a problem with Dependabot PRs before, but then that's always been with public repos.

Now, with a private repo, the GitHub Actions push event succeeds, but the pullrequest event fails with LibGit2Sharp.LibGit2SharpException: this remote has never connected. 😕

Relevant env vars:

GITHUB_ACTION=self
GITHUB_ACTIONS=true
GITHUB_ACTOR=dependabot-preview[bot]
GITHUB_BASE_REF=master
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/github/workflow/event.json
GITHUB_HEAD_REF=dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2
GITHUB_REF=refs/pull/3/merge
GITHUB_REPOSITORY=pharos/extensions-configuration
GITHUB_RUN_ID=42047370
GITHUB_RUN_NUMBER=41
GITHUB_SHA=00c1efad94a92ac038ca47d9b893c7991caaca23
GITHUB_WORKFLOW=Build
GITHUB_WORKSPACE=/github/workspace
HOME=/github/home
PWD=/github/workspace
RUNNER_OS=Linux
RUNNER_TEMP=/home/runner/work/_temp
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
RUNNER_WORKSPACE=/home/runner/work/extensions-configuration

build.log

bug

All 13 comments

Also, note that due to the current lack of support for private docker registries, I'm using a hack to run the build via a docker action defined in the repo itself.

.github/workflows/build.yml:

name: Build
on:
  push:
    branches: [ "**" ]
  pull_request:
    branches: [ master ]
  repository_dispatch:

jobs:
  Docker:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v2

      - name: Fetch unshallow
        run: git fetch --prune --tags --unshallow

      - name: Docker pull
        run: docker pull *REDACTED*

      - name: Cake build
        uses: ./.github/actions/cake-build

.github/actions/cake-build/action.yml:

name: Cake build
runs:
  using: docker
  image: docker://*REDACTED*
  args: [ "bash", "-c", 'dotnet tool restore && dotnet cake --bootstrap --verbosity=verbose && dotnet cake --verbosity=diagnostic --target=build --publish=true' ]

Not sure it's relevant though as the push event succeeds with the same workflow and action.

I've confirmed the above action hack is irrelevant by temporarily using my public docker image instead:

.github/workflows/build.yml:

name: Build
on:
  push:
    branches: [ "**" ]
  pull_request:
    branches: [ master ]
  repository_dispatch:

jobs:
  Docker:
    runs-on: ubuntu-latest
    container: dockfool/cake-docker:latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v2

      - name: Fetch unshallow
        run: git fetch --prune --tags --unshallow

      - name: Cake build
        run: dotnet tool restore && dotnet cake --bootstrap --verbosity=verbose && dotnet cake --verbosity=diagnostic --target=build --publish=true

Still fails with LibGit2Sharp.LibGit2SharpException: this remote has never connected.

Checkout source log:

2020-02-19T22:15:52.5387130Z ##[group]Run actions/checkout@v2
2020-02-19T22:15:52.5387503Z with:
2020-02-19T22:15:52.5387651Z   repository: pharos/extensions-configuration
2020-02-19T22:15:52.5387880Z   token: ***
2020-02-19T22:15:52.5388018Z   persist-credentials: true
2020-02-19T22:15:52.5388156Z   clean: true
2020-02-19T22:15:52.5388269Z   fetch-depth: 1
2020-02-19T22:15:52.5388400Z   lfs: false
2020-02-19T22:15:52.5390003Z ##[endgroup]
2020-02-19T22:15:52.9364311Z Added matchers: 'checkout-git'. Problem matchers scan action output for known warning or error strings and report these inline.
2020-02-19T22:15:52.9367287Z Syncing repository: pharos/extensions-configuration
2020-02-19T22:15:52.9368239Z Working directory is '/home/runner/work/extensions-configuration/extensions-configuration'
2020-02-19T22:15:52.9368508Z [command]/usr/bin/git version
2020-02-19T22:15:52.9506440Z git version 2.25.0
2020-02-19T22:15:53.3607830Z Deleting the contents of '/home/runner/work/extensions-configuration/extensions-configuration'
2020-02-19T22:15:53.3609487Z [command]/usr/bin/git init /home/runner/work/extensions-configuration/extensions-configuration
2020-02-19T22:15:53.3610126Z Initialized empty Git repository in /home/runner/work/extensions-configuration/extensions-configuration/.git/
2020-02-19T22:15:53.3610733Z [command]/usr/bin/git remote add origin https://github.com/pharos/extensions-configuration
2020-02-19T22:15:53.3611256Z [command]/usr/bin/git config --local gc.auto 0
2020-02-19T22:15:53.3611817Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-02-19T22:15:53.3612422Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2020-02-19T22:15:53.3614386Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +00c1efad94a92ac038ca47d9b893c7991caaca23:refs/remotes/pull/3/merge
2020-02-19T22:15:53.3614767Z remote: Enumerating objects: 35, done.
2020-02-19T22:15:53.3614989Z remote: Counting objects:   2% (1/35)
...
2020-02-19T22:15:53.3640835Z remote: Counting objects: 100% (35/35), done.
2020-02-19T22:15:53.3641001Z remote: Compressing objects:   3% (1/29)
...
2020-02-19T22:15:53.3647239Z remote: Compressing objects: 100% (29/29), done.
2020-02-19T22:15:53.3647848Z remote: Total 35 (delta 1), reused 21 (delta 0), pack-reused 0
2020-02-19T22:15:53.3648595Z From https://github.com/pharos/extensions-configuration
2020-02-19T22:15:53.3649157Z  * [new ref]         00c1efad94a92ac038ca47d9b893c7991caaca23 -> pull/3/merge
2020-02-19T22:15:53.3649683Z [command]/usr/bin/git checkout --progress --force refs/remotes/pull/3/merge
2020-02-19T22:15:53.3650296Z Note: switching to 'refs/remotes/pull/3/merge'.
2020-02-19T22:15:53.3650524Z
2020-02-19T22:15:53.3650934Z You are in 'detached HEAD' state. You can look around, make experimental
2020-02-19T22:15:53.3651339Z changes and commit them, and you can discard any commits you make in this
2020-02-19T22:15:53.3651551Z state without impacting any branches by switching back to a branch.
2020-02-19T22:15:53.3651646Z
2020-02-19T22:15:53.3651910Z If you want to create a new branch to retain commits you create, you may
2020-02-19T22:15:53.3652333Z do so (now or later) by using -c with the switch command. Example:
2020-02-19T22:15:53.3652569Z
2020-02-19T22:15:53.3654947Z   git switch -c <new-branch-name>
2020-02-19T22:15:53.3656065Z
2020-02-19T22:15:53.3656355Z Or undo this operation with:
2020-02-19T22:15:53.3656474Z
2020-02-19T22:15:53.3657351Z   git switch -
2020-02-19T22:15:53.3657464Z
2020-02-19T22:15:53.3657638Z Turn off this advice by setting config variable advice.detachedHead to false
2020-02-19T22:15:53.3657775Z
2020-02-19T22:15:53.3658205Z HEAD is now at 00c1efa Merge 33f38711c5df02646b7d850fcb8fa77e3a71b3f3 into 3ce09824a269ce61bef9aa4a65fefe26955c191f
2020-02-19T22:15:53.3659158Z [command]/usr/bin/git log -1
2020-02-19T22:15:53.3660512Z commit 00c1efad94a92ac038ca47d9b893c7991caaca23
2020-02-19T22:15:53.3662196Z Author: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-02-19T22:15:53.3662622Z Date:   Thu Feb 20 11:15:35 2020 +1300
2020-02-19T22:15:53.3663143Z
2020-02-19T22:15:53.3663401Z     Merge 33f38711c5df02646b7d850fcb8fa77e3a71b3f3 into 3ce09824a269ce61bef9aa4a65fefe26955c191f
2020-02-19T22:15:53.3665715Z Removed matchers: 'checkout-git'

Fetch unshallow log:

2020-02-19T22:15:53.3989585Z ##[group]Run git fetch --prune --tags --unshallow
2020-02-19T22:15:53.3990159Z git fetch --prune --tags --unshallow
2020-02-19T22:15:53.4031052Z shell: /bin/bash -e {0}
2020-02-19T22:15:53.4033175Z ##[endgroup]
2020-02-19T22:15:53.7963118Z From https://github.com/pharos/extensions-configuration
2020-02-19T22:15:53.7963981Z  * [new branch]      dependabot/nuget/Microsoft.Extensions.Configuration.Binder-3.1.2 -> origin/dependabot/nuget/Microsoft.Extensions.Configuration.Binder-3.1.2
2020-02-19T22:15:53.7964663Z  * [new branch]      dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2 -> origin/dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2
2020-02-19T22:15:53.7965331Z  * [new branch]      dependabot/nuget/Microsoft.Extensions.Configuration.EnvironmentVariables-3.1.2 -> origin/dependabot/nuget/Microsoft.Extensions.Configuration.EnvironmentVariables-3.1.2
2020-02-19T22:15:53.7965918Z  * [new branch]      dependabot/nuget/Microsoft.Extensions.Hosting.Abstractions-3.1.2 -> origin/dependabot/nuget/Microsoft.Extensions.Hosting.Abstractions-3.1.2
2020-02-19T22:15:53.7966375Z  * [new branch]      master      -> origin/master
2020-02-19T22:15:53.7966783Z  * [new tag]         1.0.0       -> 1.0.0
2020-02-19T22:15:53.7967185Z  * [new tag]         1.0.1       -> 1.0.1
2020-02-19T22:15:53.7967614Z  * [new tag]         1.0.2       -> 1.0.2
2020-02-19T22:15:53.7968021Z  * [new tag]         1.0.3       -> 1.0.3
2020-02-19T22:15:53.7968369Z  * [new tag]         2.0.0       -> 2.0.0
2020-02-19T22:15:53.7968937Z  * [new tag]         2.0.1       -> 2.0.1
2020-02-19T22:15:53.7969386Z  * [new tag]         2.0.2       -> 2.0.2
2020-02-19T22:15:53.7969806Z  * [new tag]         2.0.3       -> 2.0.3
2020-02-19T22:15:53.7970201Z  * [new tag]         2.1.0       -> 2.1.0
2020-02-19T22:15:53.7970600Z  * [new tag]         2.2.0       -> 2.2.0
2020-02-19T22:15:53.7971000Z  * [new tag]         2.3.0       -> 2.3.0
2020-02-19T22:15:53.7971425Z  * [new tag]         2.3.1       -> 2.3.1
2020-02-19T22:15:53.7971822Z  * [new tag]         2.3.2       -> 2.3.2
2020-02-19T22:15:53.7972216Z  * [new tag]         3.0.0       -> 3.0.0
2020-02-19T22:15:53.7972613Z  * [new tag]         3.0.1       -> 3.0.1
2020-02-19T22:15:53.7973032Z  * [new tag]         3.1.0-pre.1 -> 3.1.0-pre.1
2020-02-19T22:15:53.7973446Z  * [new tag]         3.1.0-pre.2 -> 3.1.0-pre.2
2020-02-19T22:15:53.7973860Z  * [new tag]         3.1.0-pre.3 -> 3.1.0-pre.3
2020-02-19T22:15:53.7974273Z  * [new tag]         3.1.0-pre.4 -> 3.1.0-pre.4
2020-02-19T22:15:53.7974649Z  * [new tag]         3.1.0-pre.5 -> 3.1.0-pre.5
2020-02-19T22:15:53.7975080Z  * [new tag]         4.0.0       -> 4.0.0

GitVersion log:

2020-02-19T22:16:58.9059300Z Executing: /github/workspace/tools/dotnet-gitversion -output json -verbosity Debug
2020-02-19T22:16:59.3362713Z
INFO [02/19/20 22:16:59:12] Applicable build agent found: 'GitHubActions'.
INFO [02/19/20 22:16:59:12] Working directory: /github/workspace
INFO [02/19/20 22:16:59:12] IsDynamicGitRepository: False
INFO [02/19/20 22:16:59:14] Returning Project Root from DotGitDirectory: /github/workspace/.git/ - /github/workspace/
INFO [02/19/20 22:16:59:14] Running on Unix.
INFO [02/19/20 22:16:59:14] Applicable build agent found: 'GitHubActions'.
INFO [02/19/20 22:16:59:14] Branch from build environment:
INFO [02/19/20 22:16:59:14] Begin: Normalizing git directory for branch ''
INFO [02/19/20 22:16:59:17] One remote found (origin -> 'https://github.com/pharos/extensions-configuration').
INFO [02/19/20 22:16:59:18] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
INFO [02/19/20 22:16:59:19] Creating local branch from remote tracking 'refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.Binder-3.1.2'.
INFO [02/19/20 22:16:59:21] Creating local branch from remote tracking 'refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2'.
INFO [02/19/20 22:16:59:21] Creating local branch from remote tracking 'refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.EnvironmentVariables-3.1.2'.
INFO [02/19/20 22:16:59:21] Creating local branch from remote tracking 'refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Hosting.Abstractions-3.1.2'.
INFO [02/19/20 22:16:59:21] Creating local branch from remote tracking 'refs/remotes/origin/master'.
INFO [02/19/20 22:16:59:21] HEAD is detached and points at commit '00c1efad94a92ac038ca47d9b893c7991caaca23'.
INFO [02/19/20 22:16:59:21] Local Refs:
2020-02-19T22:16:59.3363674Z refs/heads/dependabot/nuget/Microsoft.Extensions.Configuration.Binder-3.1.2 (3b236201ccc7bb63e7a7cb5b5ec2f312cddf7289)
2020-02-19T22:16:59.3364144Z refs/heads/dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2 (33f38711c5df02646b7d850fcb8fa77e3a71b3f3)
2020-02-19T22:16:59.3364806Z refs/heads/dependabot/nuget/Microsoft.Extensions.Configuration.EnvironmentVariables-3.1.2 (e91e26b7beb08f22c6a09e6171e1a0047f3219d4)
2020-02-19T22:16:59.3365269Z refs/heads/dependabot/nuget/Microsoft.Extensions.Hosting.Abstractions-3.1.2 (8941c88e130686e3b17ca306d0401585fa177ec1)
2020-02-19T22:16:59.3365443Z refs/heads/master (3ce09824a269ce61bef9aa4a65fefe26955c191f)
2020-02-19T22:16:59.3365876Z refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.Binder-3.1.2 (3b236201ccc7bb63e7a7cb5b5ec2f312cddf7289)
2020-02-19T22:16:59.3366325Z refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.CommandLine-3.1.2 (33f38711c5df02646b7d850fcb8fa77e3a71b3f3)
2020-02-19T22:16:59.3366788Z refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Configuration.EnvironmentVariables-3.1.2 (e91e26b7beb08f22c6a09e6171e1a0047f3219d4)
2020-02-19T22:16:59.3367246Z refs/remotes/origin/dependabot/nuget/Microsoft.Extensions.Hosting.Abstractions-3.1.2 (8941c88e130686e3b17ca306d0401585fa177ec1)
2020-02-19T22:16:59.3367421Z refs/remotes/origin/master (3ce09824a269ce61bef9aa4a65fefe26955c191f)
2020-02-19T22:16:59.3367581Z refs/remotes/pull/3/merge (00c1efad94a92ac038ca47d9b893c7991caaca23)
2020-02-19T22:16:59.3367742Z refs/tags/1.0.0 (b8bc8b7ac47d7e9717d7bdce2a7188131d5d213e)
2020-02-19T22:16:59.3367896Z refs/tags/1.0.1 (b79970b2f610b2532536927ea54929b1d187e1ba)
2020-02-19T22:16:59.3368041Z refs/tags/1.0.2 (b0f2ba426b997a2762e0abd40654a67103ad2f63)
2020-02-19T22:16:59.3368191Z refs/tags/1.0.3 (8610fad87318457527cbca131755a7def023ec2f)
2020-02-19T22:16:59.3368339Z refs/tags/2.0.0 (de713a42f013fc6ecee354481dfe3ec2b0ffd2c3)
2020-02-19T22:16:59.3368485Z refs/tags/2.0.1 (10eb006b6ced233d6d83d16a8515fdb4c82796f1)
2020-02-19T22:16:59.3368629Z refs/tags/2.0.2 (72af4b611ae10e87d9403228bdcda69595574215)
2020-02-19T22:16:59.3368859Z refs/tags/2.0.3 (cf7f6a840cce9aaf81725df90095142b6417ec30)
2020-02-19T22:16:59.3369023Z refs/tags/2.1.0 (a39bcb169c243e97a3e85b2e38a81ea4bb2401dc)
2020-02-19T22:16:59.3369166Z refs/tags/2.2.0 (57788cbc8d7043b23d139392ea60d22444a10380)
2020-02-19T22:16:59.3369310Z refs/tags/2.3.0 (79f438641a1707731c43aeab430a8c370e16aee4)
2020-02-19T22:16:59.3369453Z refs/tags/2.3.1 (c59e71708b16c27215afdb136867a77285068b7c)
2020-02-19T22:16:59.3369597Z refs/tags/2.3.2 (920f9d7c347bc1aa3067e28d58b169a6d05a7504)
2020-02-19T22:16:59.3369738Z refs/tags/3.0.0 (058e0fba64d8e10b0631337a8b5b368798bf5ecd)
2020-02-19T22:16:59.3369881Z refs/tags/3.0.1 (1e56d16fca48a7d9849819f2d5269b09b48be1ae)
2020-02-19T22:16:59.3370246Z refs/tags/3.1.0-pre.1 (3883e6468580693032ba7abfad34aad4ac7f3fa4)
2020-02-19T22:16:59.3370604Z refs/tags/3.1.0-pre.2 (11e11fbe9defff5cf368d2a09ef700256fb23d96)
2020-02-19T22:16:59.3370957Z refs/tags/3.1.0-pre.3 (d873d776f9887ddb4ef1386b5c8094b7ae358151)
2020-02-19T22:16:59.3371307Z refs/tags/3.1.0-pre.4 (7bab057e8e9d9c07283090d1751e7edda191e7e9)
2020-02-19T22:16:59.3371660Z refs/tags/3.1.0-pre.5 (eb549e8792e2feff7ed9cd313a1f71d8096d6023)
2020-02-19T22:16:59.3372493Z refs/tags/4.0.0 (0b832c6ee0726b813052b1c1eaf9f3adb6d3d0a0)
INFO [02/19/20 22:16:59:22] No local branch pointing at the commit '00c1efad94a92ac038ca47d9b893c7991caaca23'. Fake branch needs to be created.
INFO [02/19/20 22:16:59:22] Fetching remote refs to see if there is a pull request ref
INFO [02/19/20 22:16:59:29] End: Normalizing git directory for branch '' (Took: 148.46ms)  $1
ERROR [02/19/20 22:16:59:31] An unexpected error occurred:
2020-02-19T22:16:59.3372758Z LibGit2Sharp.LibGit2SharpException: this remote has never connected
2020-02-19T22:16:59.3372918Z    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2020-02-19T22:16:59.3373095Z    at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote)
2020-02-19T22:16:59.3373278Z    at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider)
2020-02-19T22:16:59.3373455Z    at LibGit2Sharp.Network.ListReferences(Remote remote)
2020-02-19T22:16:59.3373698Z    at GitVersion.Helpers.GitRepositoryHelper.GetRemoteTipsForAnonymousUser(Repository repo, Remote remote) in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 262
2020-02-19T22:16:59.3373925Z    at GitVersion.Helpers.GitRepositoryHelper.CreateFakeBranchPointingAtThePullRequestTip(ILog log, Repository repo, AuthenticationInfo authentication) in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 201
2020-02-19T22:16:59.3374181Z    at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 111
2020-02-19T22:16:59.3374449Z    at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository) in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 190
2020-02-19T22:16:59.3374668Z    at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 65
2020-02-19T22:16:59.3374864Z    at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\1\s\src\GitVersionCore\GitVersionCalculator.cs:line 54
2020-02-19T22:16:59.3375037Z    at GitVersion.ExecCommand.Execute() in D:\a\1\s\src\GitVersionExe\ExecCommand.cs:line 40
2020-02-19T22:16:59.3375262Z    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\1\s\src\GitVersionExe\GitVersionExecutor.cs:line 117
...

Conclusion: GitVersion fails to create a fake local tracking branch for the detached head of the pull request in CreateFakeBranchPointingAtThePullRequestTip. I didn't supply authentication credentials to GitVersion and GetRemoteTipsForAnonymousUser fails.

Having to supply credentials is actually a PITA, which has given me reason to pause and reconsider. Surely, if GitVersion detects it's running on a GitHub Actions build server, it has what it needs via env vars?

Looking more closely at GitHubActions.GetCurrentBranch, without having the familiarity to know exactly how GitVersion is supposed to work, I'm wondering if there's a bug lurking. In this case, the GITHUB_REF env var is defined as refs/pull/3/merge, but because it doesn't start with refs/heads/ it gets thrown away, and the base class returns null. This aligns with the GitVersions logs:

INFO [02/19/20 22:16:59:14] Branch from build environment:
INFO [02/19/20 22:16:59:14] Begin: Normalizing git directory for branch ''

This is also inconsistent with the treatment of other build servers, like Azure Pipelines, where AzurePipelines.GetCurrentBranch simply returns the BUILD_SOURCEBRANCH env var without any further processing; and interestingly enough this recent Dependabot pull request to another public repo of mine has logging that shows this env var is defined similarly as refs/pull/14/merge.

So it begs the question, why does the GitHub Actions build server do what it does, which is different from the Azure Pipelines build server for the same input; is the current implementation a bug? 🤔

That was an interesting investigation to read. I think we need to fix the way we get the branch name. I also noticed on GitHub actions for pull requests it fails but it did not have the time to investigate. Now I have some inputs, thanks a lot

@gitfool would you mind trying https://www.nuget.org/packages/GitVersion.Tool/5.1.4-beta1.171? Can you tell me if it fixed the issue?

@arturcic I can't quite get that far as it now fails trying to build a patched library on a non-PR branch:

GitVersion log:

INFO [02/21/20 19:44:13:46] Applicable build agent found: 'GitHubActions'.
INFO [02/21/20 19:44:13:47] Working directory: /home/runner/work/build-cake/build-cake
INFO [02/21/20 19:44:13:47] IsDynamicGitRepository: False
INFO [02/21/20 19:44:13:48] Returning Project Root from DotGitDirectory: /home/runner/work/build-cake/build-cake/.git/ - /home/runner/work/build-cake/build-cake/
INFO [02/21/20 19:44:13:48] Running on Unix.
INFO [02/21/20 19:44:13:48] Applicable build agent found: 'GitHubActions'.
INFO [02/21/20 19:44:13:48] Branch from build environment: gitversion-beta
INFO [02/21/20 19:44:13:49] Begin: Normalizing git directory for branch 'gitversion-beta'  
INFO [02/21/20 19:44:13:52] One remote found (origin -> 'https://github.com/pharos/build-cake').  
INFO [02/21/20 19:44:13:52] Fetching from remote 'origin' using the following refspecs: +refs/heads/*:refs/remotes/origin/*.  
INFO [02/21/20 19:44:13:63] End: Normalizing git directory for branch 'gitversion-beta' (Took: 149.01ms)  
ERROR [02/21/20 19:44:13:65] An unexpected error occurred:
2020-02-21T19:44:13.7027719Z LibGit2Sharp.LibGit2SharpException: remote authentication required but no callback set
2020-02-21T19:44:13.7027967Z    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2020-02-21T19:44:13.7028198Z    at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
2020-02-21T19:44:13.7028426Z    at LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle remote, IEnumerable`1 refSpecs, GitFetchOptions fetchOptions, String logMessage)
2020-02-21T19:44:13.7028687Z    at LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable`1 refspecs, FetchOptions options, String logMessage)
2020-02-21T19:44:13.7028954Z    at GitVersion.Helpers.GitRepositoryHelper.Fetch(ILog log, AuthenticationInfo authentication, Remote remote, Repository repo) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 145
2020-02-21T19:44:13.7029238Z    at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 40
2020-02-21T19:44:13.7029521Z    at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitPreparer.cs:line 190
2020-02-21T19:44:13.7029786Z    at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitPreparer.cs:line 65
2020-02-21T19:44:13.7030040Z    at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitVersionCalculator.cs:line 51
2020-02-21T19:44:13.7030272Z    at GitVersion.ExecCommand.Execute() in D:\a\GitVersion\GitVersion\src\GitVersionExe\ExecCommand.cs:line 39
2020-02-21T19:44:13.7031622Z    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\GitVersion\GitVersion\src\GitVersionExe\GitVersionExecutor.cs:line 117  

Looks like this is now trying to fetch from the remote due to change f9e9d35, which would force me to supply credentials to GitVersion. Surely not intended?

I also see you didn't change the GitHubActions.GetCurrentBranch behavior I described above❓

@arturcic can we please work through this issue before you publish 5.1.4? 😛

Ok I'll postpone the new version. Do you mind sending a PR with the fix you're envisioning?

Sure

@gitfool can you confirm 5.1.4-beta1-182 fixed the issue?

@arturcic confirmed!

Was this page helpful?
0 / 5 - 0 ratings