Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE]: gittools/actions/gitversion/execute GitVersion output is not valid JSON output is undefined in Github Action after upgrade from v0 to v3 #1490

Open
2 tasks done
heddal opened this issue Feb 5, 2025 · 1 comment

Comments

@heddal
Copy link

heddal commented Feb 5, 2025

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitHub Actions

What are you seeing?

We have updated the GitTools execute action from v0 to v3.1.11. In these major bumps, additionalArguments has been removed (#1203). Previously, we had the following in our workflow:

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v0
   with:
      additionalArguments: /overrideconfig mode=Mainline

At first, we upgraded just the version number (above @v0 -> @v3.1.11) without removing the additionalArguments param. This works, the workflow still runs, but we understandably get this warning

Warning: Unexpected input(s) 'additionalArguments', valid inputs are ['targetPath', 'disableCache', 'disableNormalization', 'disableShallowCloneCheck', 'useConfigFile', 'configFilePath', 'overrideConfig', 'updateAssemblyInfo', 'updateAssemblyInfoFilename']

Therefore I tried updating the workflow job to the following:

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v3.1.11
   with:
      useConfigFile: true

With a simple config file GitVersion.yml at root containing one line: mode: Mainline. Mysteriously, this results is the following error in our workflow:

Error: GitVersion output is not valid JSON
dotnet-gitversion Output:
undefined

I get the same error if I remove the parameters all together like this:

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v3.1.11

The steps before this looks like this:

- name: Checkout
   uses: actions/checkout@v3
   with:
       fetch-depth: 0

- name: ⚙️ Set up dotnet
   uses: actions/setup-dotnet@v4
   with:
      global-json-file: ./global.json

- name: Install GitVersion
   uses: gittools/actions/gitversion/setup@v3.1.11
   with:
      versionSpec: '6.0.x'

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v3.1.11

Can you help me to understand why this happens and what I can do to fix it?

What is expected?

I expect this workflow step to work as described in the documentation here.

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/execute@v3.1.11
   with:
      useConfigFile: true

Steps to Reproduce

Reproducible steps given in the description above. We are running the workflow job on ubuntu-latest. The Github repository is private so I cannot share logs or code with you, unfortunately.

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

@heddal
Copy link
Author

heddal commented Feb 6, 2025

"Solved" this by changing the versionSpec from 6.0.x to 5.x, and only specify major version of execute from gittools/actions/gitversion/setup@v3 instead of gittools/actions/gitversion/setup@v3.1.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant