JRubics / poetry-publish

An action to build and publish python package to pypi (https://pypi.org/) using poetry (https://github.com/sdispater/poetry)
BSD 3-Clause "New" or "Revised" License
137 stars 17 forks source link

Issue with File Permissions on dist/ files #28

Closed travis-cook-sfdc closed 1 year ago

travis-cook-sfdc commented 1 year ago

I'm working in a GitHub Enterprise environment that uses self-hosted machines to run github actions. The github actions are run under a non-root foo user. Because docker runs as a root / privileged user, the dist/ files this action creates end up on the host machine with root permissions. Then, when the action reruns, the foo user does not have permissions to checkout & cleanup the previously created files.

Some ideas I've had to try to resolve this but figure I'd raise the issue here:

What do you think would make the most sense given the issue?

JRubics commented 1 year ago

Hi :slightly_smiling_face: First thing that comes to my mind is running a hook after job completes to clean up the problematic directory: https://docs.github.com/en/actions/hosting-your-own-runners/running-scripts-before-or-after-a-job Can this solve your issue? Whatever we decide to do for your case, I would do it after the action run and not before the next run since you won't need it between runs anyways.

I would like to avoid adding any additional step that is not necessary because it can slow down the action run, so I think it is better to call that additional cleanup only when you need it :slightly_smiling_face:

If you like the given solution, please test it and let me know if it works. If it doesn't, we will think of something else :slightly_smiling_face:

travis-cook-sfdc commented 1 year ago

Ah yeah - that makes a lot of sense to me. I ended up using this action in order to clean up the directory: https://github.com/peter-murray/reset-workspace-ownership-action/blob/main/README.md

JRubics commented 1 year ago

Happy to hear you managed to solve the issue :tada: