GitTools / actions

GitHub Action that installs and uses the GitVersion and GitReleaseManager tools
MIT License
218 stars 63 forks source link

BUG: execute action can't find configFilePath if it is located in sub-folder #1206

Closed luber closed 1 month ago

luber commented 1 month ago

Prerequisites

GitVersion package

GitHub Actions

What are you seeing?

Error: Command failed: /opt/hostedtoolcache/GitVersion.Tool/6.0.0/dotnet-gitversion ./web-apps /output json /output buildserver /config web-apps/.gitversion.yml Unhandled exception. GitVersion.WarningException: Could not find config file at '/home/runner/work/co-pilot/co-pilot/web-apps/web-apps/.gitversion.yml'

What is expected?

configFilePath detected correctly when it is not in the repo root, but sub-folder (a mono-repo case)

Steps to Reproduce

try to detect the git version with the latest version of GitHub Actions for the project in 'web-apps' sub-folder

  - name: Install GitVersion
    uses: gittools/actions/gitversion/setup@v3.0.0
    with:
      versionSpec: '6.x'
      preferLatestVersion: true

  - name: Determine Version for BMS Web App
    id: gitversion
    uses: gittools/actions/gitversion/execute@v3.0.0
    with:
      targetPath: ./web-apps
      useConfigFile: true
      configFilePath: 'web-apps/.gitversion.yml'

Output log or link to your CI build (if appropriate).

Run gittools/actions/gitversion/execute@v3.0.0

Running on: 'GitHub Actions'
Disable Telemetry
Executing GitVersion
Command: git -C ./web-apps rev-parse --is-shallow-repository
Command: /opt/hostedtoolcache/GitVersion.Tool/6.0.0/dotnet-gitversion ./web-apps /output json /output buildserver /config web-apps/.gitversion.yml
Error: Command failed: /opt/hostedtoolcache/GitVersion.Tool/6.0.0/dotnet-gitversion ./web-apps /output json /output buildserver /config web-apps/.gitversion.yml
Unhandled exception. GitVersion.WarningException: Could not find config file at '/home/runner/work/co-pilot/co-pilot/web-apps/web-apps/.gitversion.yml'
   at GitVersion.ArgumentParser.ValidateConfigurationFile(Arguments arguments) in /_/src/GitVersion.App/ArgumentParser.cs:line 112
   at GitVersion.ArgumentParser.ParseArguments(String[] commandLineArguments) in /_/src/GitVersion.App/ArgumentParser.cs:line 95
   at GitVersion.Program.<>c__DisplayClass4_0.<CreateHostBuilder>b__2(IServiceProvider sp) in /_/src/GitVersion.App/Program.cs:line 36
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Mi
luber commented 1 month ago

The workaround is to rollback to older version:

arturcic commented 1 month ago

@luber can you try this instead?

  - name: Install GitVersion
    uses: gittools/actions/gitversion/setup@v3.0.0
    with:
      versionSpec: '5.x'
      preferLatestVersion: true

  - name: Determine Version for BMS Web App
    id: gitversion
    uses: gittools/actions/gitversion/execute@v3.0.0
    with:
      targetPath: ./web-apps
      useConfigFile: true
      configFilePath: 'web-apps/.gitversion.yml'

So basically only the version spec changes, but you're still using the new actions

luber commented 1 month ago

@luber can you try this instead?

  - name: Install GitVersion
    uses: gittools/actions/gitversion/setup@v3.0.0
    with:
      versionSpec: '5.x'
      preferLatestVersion: true

  - name: Determine Version for BMS Web App
    id: gitversion
    uses: gittools/actions/gitversion/execute@v3.0.0
    with:
      targetPath: ./web-apps
      useConfigFile: true
      configFilePath: 'web-apps/.gitversion.yml'

So basically only the version spec changes, but you're still using the new actions

Yes. That works

arturcic commented 1 month ago

@luber can you try this instead?

  - name: Install GitVersion
    uses: gittools/actions/gitversion/setup@v3.0.0
    with:
      versionSpec: '5.x'
      preferLatestVersion: true

  - name: Determine Version for BMS Web App
    id: gitversion
    uses: gittools/actions/gitversion/execute@v3.0.0
    with:
      targetPath: ./web-apps
      useConfigFile: true
      configFilePath: 'web-apps/.gitversion.yml'

So basically only the version spec changes, but you're still using the new actions

Yes. That works

That means it's a GitVersion v6 issue.