actions / setup-dotnet

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

All dotnet commands fail due to environment variables #510

Closed william-dafriend closed 5 months ago

william-dafriend commented 7 months ago

Description: All attempts at using the action fail with the following error

/usr/share/dotnet/sdk/8.0.101/NuGet.targets(424,5): error MSB4018: System.InvalidOperationException: Required environment variable 'HOME' is not set. Try setting 'DOTNET_CLI_HOME' or 'HOME' and running the operation 

Task version: version 4

Platform:

Runner type:

Repro steps:
Attempt to run an action using setup-dotnet/v4 and call any dotnet command

Expected behavior: commands should complete successfully

Actual behavior: Comamnds return errors about missing environment variables

All dotnet commands work fine in the _work directory directly on the runner. I have tried explicitly setting HOME and DOTNET_CLI_HOME environment variables in the action itself. These variables are both set and exported for the user on the github runner.

HarithaVattikuti commented 7 months ago

Hello @william-dafriend Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

gd-pmayhew commented 7 months ago

@william-dafriend If you are running your action-runner as a service on Linux, make sure the service is installed to use a user account, otherwise it will default to root; where these aren't defined. If you want to use root, then export DONET_CLI_HOME=/tmp and that will get you past this issue.

aparnajyothi-y commented 6 months ago

Hello @william-dafriend, Thank you for creating the issue and we have investigated the issue. Understood that you have tried setting both the HOME and DOTNET_CLI_HOME environment variables directly in the action itself and you might do this in a workflow file:

steps:

We have tested the same in our local, able to set the the environment variables through the workflow and the commands are successful. Please find the screenshot for reference.

image

Please confirm whether you have set the env variables by following the above step in your workflow.

aparnajyothi-y commented 6 months ago

Hello @william-dafriend, Please confirm whether you have set the env variables by following the above step in your workflow.

aparnajyothi-y commented 5 months ago

Hello @william-dafriend, Please confirm whether you have set the env variables by following the above step in your workflow.

aparnajyothi-y commented 5 months ago

Closing this issue as we don't hear any response from long time. Please feel free to reach us if you are still facing the issue.