Skip to content

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

@heddal

Description

@heddal

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/[email protected]
   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/[email protected]

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/[email protected]
   with:
      versionSpec: '6.0.x'

- name: Determine Version
   id: gitversion
   uses: gittools/actions/gitversion/[email protected]

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/[email protected]
   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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions