snok / install-poetry

Github action for installing and configuring Poetry
MIT License
572 stars 53 forks source link

Fix permission denied on windows #137

Closed miigotu closed 10 months ago

miigotu commented 10 months ago

I'm not sure if this fixes any error on windows when using github actions directly, but this fixes the following error when using netkos/act

This error happens with bash as default run.

[Python Packaging/Test-4]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2-composite-0.sh] user= workdir=
| /var/run/act/workflow/2-composite-0.sh: line 2: /var/run/act/actions/snok-install-poetry@master/main.sh: Permission denied
[Python Packaging/Test-4]   ❌  Failure - Main Install and configure Poetry

/var/run/act/workflow/2-composite-0.sh contains $GITHUB_ACTIONS_PATH/main.sh

Maybe this should be done differently, but the script is not executable so the shebang doesnt work.

sondrelg commented 10 months ago

Any idea why? Seems like this is what should be happening anyways, right?

miigotu commented 10 months ago

Any idea why? Seems like this is what should be happening anyways, right?

It just calls the script like ./main.sh, and even though the file is executable outside of the runner, when it is copied into the runner it ends up not executable. I'm not sure why, but calling it with bash directly fixes it

sondrelg commented 10 months ago

Do you think we'd be able to add a test to make sure we don't break executability again? Does it only really happen locally?

miigotu commented 10 months ago

I'll test it a bit when I get back to a PC. I'm not sure if it's only local or not right now, but I know previously I had to disable testing on windows with CI.

sondrelg commented 10 months ago

I have a linux and macbook available if you want me to try something out on those :relaxed:

miigotu commented 10 months ago

So, heres the issue. netkos/act runs github actions locally, insode a docker container. It copies the action into the runner with docker cp, which changes the file permissions to 644

If i run my workflow on github with this PR change, using bash $GUTHUB_WORKSPACE/main.sh, intall_poetry activates inside that base terminal and then is not activated after the main.sh completes and lets the bash terminal close.

So, thats obviously a problem (command poetry not found)

I'm going to close this and try to find another way. I think a chmod +755 $GUTHUB_WORKSPACE/main.sh && $GUTHUB_WORKSPACE/main.sh would work both ways, but thats really ugly.