Skip to content

[Bug] New GenerateBuildLogOutput for GitHub Actions in 5.5.0 doesn't export variables #2449

@DavidBoike

Description

@DavidBoike

Describe the bug
It turns out #2422 was an incorrect implementation of GitHub Actions' new way of exporting environment variables from a workflow step. GitHub Actions does not parse environment variables out of the log output. It generates a temporary file, which is different for every step of a workflow, that it identifies using the $GITHUB_ENV environment variable. You need to write each key as {NAME}={VALUE} to that temp file. GitHub Actions then parses that file and then (I believe) disposes of it before the next step starts.

Expected Behavior

GitVersion_{NAME} variables should be available as environment variables for workflow steps after GitVersion runs.

Actual Behavior

All GitVersion_{NAME} environment variables are missing.

Possible Fix

See PR

Steps to Reproduce

Run a build with GitVersion using GitHub actions, this example uses windows-latest, using a workflow including:

…
    steps:
      (other steps)
      - name: Build
        run: dotnet build … (project with GitVersion)
      - name: Output GitVersion value
        run: echo "GitVersion_FullSemVer: $env:GitVersion_FullSemVer" 

Output will not include FullSemVer value.

Context

Your Environment

  • Version Used: 5.5.0
  • Operating System and version (Windows 10, Ubuntu 18.04): windows-latest but would affect all runner environments
  • Link to your project:
  • Link to your CI build (if appropriate):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions