create-pull-request
create-pull-request copied to clipboard
Permission denied after Resetting base branch
Subject of the issue
I am trying to automate composer updates, using a scheduled action to run 'Composer updates' and then open a new pull request from master for review. But I always get some permission denied errors.

Steps to reproduce
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: php-actions/composer@v2
with:
command: update drupal/core-recommended
dev: yes
args: --ignore-platform-reqs --with-dependencies
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.NICKS_PAT }}
commit-message: Update dependencies
title: Update dependencies
delete-branch: false
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-dependencies
base: master
Seems like it could be a file permission error? https://stackoverflow.com/questions/11774397/git-push-error-unable-to-unlink-old-permission-denied/26950991 Do I maybe have to run a CHMOD between the checkout and the Pull Request steps?
I am on windows but I use a WSL2 Linux sub-system to do most development. So I could be an edge case and why the other examples don't have these problems?
Hi @NickStees
It looks like a file or directory permission issue, but I've not seen this before. I think it's unrelated to the action itself and probably something that would also be reproducible if the repository was checked out locally. My advice would be to reproduce it locally and then try some of the suggestions in that Stackoverflow question. You might need to commit file/directory permission changes back to the repository to fix it.
You could also try using a windows runner on the off-chance that makes a difference.
runs-on: windows-latest
I'm getting a similar error. I'm following this example: https://github.com/lilt/lilt-java/blob/master/.github/workflows/openapi.yml Can't tell what's different. In my case the actual error is due to uncommitted files in the working tree.
@orozcoadrian It sounds like a different issue to me. Please could you make a new issue and provide more details such as the exact workflow you are running and ideally a link to actions log if it's a public repository.
I'm getting a similar error. I'm following this example: https://github.com/lilt/lilt-java/blob/master/.github/workflows/openapi.yml Can't tell what's different. In my case the actual error is due to uncommitted files in the working tree.
I'm having a similar issue, my workflow just unzips a folder and tries to commit the unzipped files to the main
warning: unable to unlink 'release/Test/.DS_Store': Permission denied
warning: unable to unlink 'release/Test/test.txt': Permission denied
warning: unable to unlink 'release/__MACOSX/Test/._.DS_Store': Permission denied
HEAD is now at 1315813 zip with similar structure as solutions files
/usr/bin/git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --unshallow origin create-pull-request/patch:refs/remotes/origin/create-pull-request/patch
fatal: couldn't find remote ref create-pull-request/patch
Pull request branch 'create-pull-request/patch' does not exist yet.
/usr/bin/git checkout --progress -B create-pull-request/patch 60feda2d-f81a-46de-9acb-ed508987ba14
error: The following untracked working tree files would be overwritten by checkout:
release/Test/.DS_Store
release/Test/test.txt
release/__MACOSX/Test/._.DS_Store
Please move or remove them before you switch branches.
Aborting
Error: The process '/usr/bin/git' failed with exit code 1
@ougni It looks like a permissions issue with one or more of your repository directories. See this answer: https://stackoverflow.com/questions/11774397/git-push-error-unable-to-unlink-old-permission-denied/26950991
Try running sudo chmod -R g+w on the directories that don't have the correct permissions and then push the file mode changes to git to fix it in the default branch.
I had this problem recently and adding sudo chown -R $USER:$USER . step solved the problem
Had this issue as well.
In our scenario, we were downloading strings.xml files from a translations service. For the files that already existed and were only being modified, there were no issues. However, there were some new files that were added that were contained in completely new folders that previously did not exist. I'm no expert, but after several attempts, my suspicion was that those newly created folders, did not inherit any of the permissions that existing folders would have.
If we added those files (blank) so that they already existed before running there worker, there were no issues. (But we didn't want to have to pre-emptively add a bunch of empty files).
sudo chmod -R g+w did not work.
sudo chmod 777 worked (but probably too high)
sudo chown -R $USER:$USER . worked (what we're going with)