actions / setup-dotnet

Set up your GitHub Actions workflow with a specific version of the .NET core sdk
MIT License
943 stars 458 forks source link

global-json-file input does not accept absolute paths #378

Closed othmane-kinane-nw closed 1 year ago

othmane-kinane-nw commented 1 year ago

Description: setup-dotnet does not handle correctly absolute paths as value for the global-json-file input. The action always join the provided value with the github workspace (aka respository's root) instead of using it as-is if it's an absolute path.

Task version: v3

Platform:

Runner type:

Repro steps:
Pass an absolute path as value for the global-json-file input that points to a global.json file in a subfolder. Do not use the dotnet-version input. ex:

    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        global-json-file: ${{ github.workspace }}/backend/global.json

Expected behavior: The action finishes with success and the provided global.json is used.

Actual behavior: The action fails with this error:

Error: The specified global.json file '/home/runner/work/reponame/reponame/backend/global.json' does not exist
othmane-kinane-nw commented 1 year ago

The fix is to replace join by resolve. I can create a PR if you agree:

image

panticmilos commented 1 year ago

hi @othmane-kinane-nw, thank you for the report and the proposed solution. We will take a look at it

panticmilos commented 1 year ago

hi @othmane-kinane-nw, would you be willing to provide the PR for this issue? :)

panticmilos commented 1 year ago

hi @othmane-kinane-nw, just to double check are you willing to provide the PR? If you don't have time I can provide the PR :)

bamfbamf commented 1 year ago

Any news on this? I still get error when only global-json-file: is specified.

othmane-kinane-nw commented 1 year ago

hi @othmane-kinane-nw, just to double check are you willing to provide the PR? If you don't have time I can provide the PR :)

Sorry for the late reply. I will try to create the PR this week. The fix is a one liner but I have to go through the contributor guidelines and eventually add tests.

othmane-kinane-nw commented 1 year ago

hi @othmane-kinane-nw, just to double check are you willing to provide the PR? If you don't have time I can provide the PR :)

@panticmilos I just created the PR: https://github.com/actions/setup-dotnet/pull/396

panticmilos commented 1 year ago

@othmane-kinane-nw, thank you for the update! :) I have reviewed it, I will require a few more reviews but generally, all seems to be fine to me.