Running an action via svc start doesn't update runners environment variables - causing failures on jobs
How to reproduce:
method 1:
- install and run self-hosted runner on a mac build machine (i.e.
./svc.sh installand ./svc.sh start`) - Add some new items to your
$PATHvariable - restart your runner so changes take effect with
./svc.sh stopand./svc.sh start - Run your job that requires the new PATH dependencies
Expected behaviour: New variables added to path can now be accessed via the Action
Actual behaviour:
You'll get the same error as the path was not updated for some reason. But if you activate the runner via run.sh then the changes will take effect.
I've worked around this by manually editing the .paths file in actions-runner. But I recently tried the same with my homebrew installation and it isn't working even after updating the path. Is there a saved version of the .zshrc file within the actions-runner folder or something?
Anyone home?
bump
Have you found a solution?
@EricB-ADI I just created my own function in the svc.sh file:
function refresh() {
# Github actions is awful so creating a custom func to update env
source ~/.bash_profile
source ~/.zshrc
source ~/.bashrc
rm -rf .path
touch .path
echo $PATH >> .path
echo "Check path is as expected"
cat .path
}
Hope that helps
Try to add the env vars to a .env file in the root of your actions-runner service dir and restart the service.