Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied git clean -f -d #1484

Closed
JohannesDeml opened this issue Jan 10, 2023 · 2 comments
Closed

Permission denied git clean -f -d #1484

JohannesDeml opened this issue Jan 10, 2023 · 2 comments

Comments

@JohannesDeml
Copy link

Subject of the issue

I'm running into the following error when executing the action in my workflow:

 /usr/bin/git symbolic-ref HEAD --short
  master
  Working base is branch 'master'
  /usr/bin/git checkout --progress -B be44dcf7-7fc7-40ed-8880-146583d89f4d HEAD --
  Switched to a new branch 'be44dcf7-7fc7-40ed-8880-146583d89f4d'
  M	Packages/manifest.json
  M	Packages/packages-lock.json
  M	ProjectSettings/ProjectVersion.txt
  /usr/bin/git status --porcelain -unormal --
   M Packages/manifest.json
   M Packages/packages-lock.json
   M ProjectSettings/ProjectVersion.txt
  Uncommitted changes found. Adding a commit.
  /usr/bin/git add -A
  /usr/bin/git -c author.name=JohannesDeml -c author.email=JohannesDeml@users.noreply.github.com -c committer.name=GitHub -c committer.email=noreply@github.com commit -m [Automated workflow] upgrade-unity to $UNITY_VERSION
  [be44dcf7-7fc7-40ed-8880-146583d89f4d 184e8e5] [Automated workflow] upgrade-unity to $UNITY_VERSION
   Author: JohannesDeml <JohannesDeml@users.noreply.github.com>
   3 files changed, 4 insertions(+), 4 deletions(-)
  /usr/bin/git reset --hard
  HEAD is now at 184e8e5 [Automated workflow] upgrade-unity to $UNITY_VERSION
  /usr/bin/git clean -f -d
  warning: failed to remove build/WebGL: Permission denied
  Error: The process '/usr/bin/git' failed with exit code 1

The folder build/WebGL was created beforehand by the action of unity-builder. Why do we even need to run git clean -f -d and is this a user rights problem or something different? I tried both a personal access token classic as well as the fine grained personal access token, but that does not make a difference.

Steps to reproduce

  1. Run the following workflow: https://github.com/JohannesDeml/UnityWebGL-LoadingTest/blob/fe9724a0c167658341889908a997b842de8d6ad4/.github/workflows/upgrade-unity.yml
  2. Notice that the cleanup does not run through
@peter-evans
Copy link
Owner

peter-evans commented Jan 11, 2023

Hi @JohannesDeml

It looks like a user rights issue for the local build/WebGL directory. Perhaps it gets created with read-only permission for the current user. You can probably run a command as a step in your workflow to elevate the permissions and allow the directory to be deleted. This issue might be related and/or have some ideas to solve it. #783

The action needs to run git clean -f -d to make sure there are no remaining tracked or untracked changes that haven't been committed.

@JohannesDeml
Copy link
Author

Hi @peter-evans ,

thanks a lot for the quick response! Elevated rights did the trick, I added the following before running this action:

      - name: Delete build folder with elevated rights
        run: sudo rm -r ./build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants