stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
1.92k stars 224 forks source link

BUG: Default Commit username and email #331

Closed actuarysailor closed 1 month ago

actuarysailor commented 1 month ago

git-auto-commit Version

V5.0.1

Machine Type

Ubuntu (eg. ubuntu-latest)

Bug description

The default username and email you use does not have permission to repo. You documentation does not show how to grant permissions either since it is not a valid GitHub user account.

Steps to reproduce

▶ Run stefanzweifel/git-auto-commit-action@v5.0.1 image

Tried solutions

Tried granting your GitHub bot permission, but GitHub says unable to find user to add as collaborator

Example Workflow

https://github.com/actuarysailor/gha-repo-manager/actions/runs/9341254332/job/25707872777#step:5:1

Relevant log output

See above
actuarysailor commented 1 month ago

Nevermind, if you provide a token to the action/checkout step it works... You have it in your readme, but might want to highlight it sooner in your readme; quite a ways down and seems like a common issue after searching your issue history (closed)

stefanzweifel commented 1 month ago

Thanks for opening an issue.

The default username and email you use does not have permission to repo.

The default username or email for the commit has nothing do to with the permissions, if a commit can be pushed. These default values just represent the "Github Actions" user and help differentiate commits made from bots and users.

The first few lines of the usage documentation explain, that the contents-permission has to be set on the job level, so that the default GITHUB_TOKEN applied by GitHub Actions has access to push a commit back to the repository.[^1]

A custom access token is required if your repository has certain settings enabled (like protected branches). As the majority of repos doesn't use the settings, the documentation for this is a bit further down in the README.


As your link to the example workflows leads to a 404 page, I can't give you more details on why your experience with the action wasn't up to par.

[^1]: I agree, that the inner-workings of how the GITHUB_TOKEN is used, is too hidden. I will try to incorporate this into the documentation.