Skip to content

Wrong BuildingRef when a prior GitHub action moves HEAD #50

@vchirikov

Description

@vchirikov

Hi,

I use PR comment commands like /publish with github actions, and as you might know that workflows triggered on issue_comment started from the default branch (master in my case), thus the

https://github.com/dotnet/Nerdbank.GitVersioning/blob/85241588765ce921ac50132841dee932fab3956e/src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs#L23

works wrong.

I have something like this in workflow:

      - name: git checkout / on 'workflow_call'
        if: ${{ inputs.ref != '' }}
        uses: actions/checkout@v3
        with:
          clean: false
          # branch name
          ref: ${{ inputs.ref }}
          fetch-depth: 0
...
      - name: Generate version variables
        id: nbgv
        uses: dotnet/nbgv@master
        with:
          setAllVars: true

And I can't do something like echo "GITHUB_REF=refs/heads/$branch" >> $GITHUB_ENV because:

If you attempt to override the value of one of these default environment variables, the assignment is ignored.

Docs

So I can't override the wrong GITHUB_REFvalue and because of that nbgv step generates wrong version info.

Do you have any ideas how to beat this?

cc: @AArnott

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions