Closed lukepighetti closed 4 months ago
I assume it's this workflow file, right? https://github.com/lukepighetti/mastodon_dart/blob/82b76b990435f9b3d8b69ec1778c686adedbc105/.github/workflows/main.yml#L4
You probably need to switch to listen to the pull_request_target
event. Pushing commits in forks is a bit of a hassle. We added a section to the README a while ago about this: https://github.com/stefanzweifel/git-auto-commit-action#advanced-uses
I'm not 100% sure, if you can keep triggers for both pull_request_target
and pull_request
in your workflow.
(I have an open task to check if this behaviour still works with forks; just haven't had the time yet to test it.)
We should probably also update the example in the README, to make it clearer how the example works with forks.
Ah, just came across this. Good thing I looked in issues first.
So the net of it is that it kind of is doable, but is hard to config, and might not work at all depending on the setup of the fork? And all due to GitHub limitations?
@deitch Yeah, this sums it up pretty nicely. Technically kinda doable but you run into road blocks constantly, due to how GitHub wants GitHub Actions to work for forks.
That really is a pity. I can see some real patterns where you might want generated stuff as part of your repo (i.e. committed in), but not have the user do it. This is like compilation, but unlike normal compiled binaries (where it doesn't make sense), here it does. My current use case is language bindings generated from protobufs, but I can see transpiled code, graph images, lots of other cases.
@deitch That's exactly the use case why I've created this project; and it does work as you described.
Problems sometimes appear when people use this Action in workflows that should work for both Maintainers and Forks in the exact same way.
In the past we had many discussions/issues around forks. Almost all issues have been resolved by changing the workflow or repository settings. I'm liking a few here; maybe they help you or others coming across this thread.
I also know of a couple of bigger GitHub organisations that use this action to fix code style issues in their open source projects.
For example @spatie is using the Action in a workflow that just listens to the push
event. In a pull request from May the action successfully pushed a commit to the fork (commit sha 4e853b5
)
Or the @laravel org uses this workflow in all repositories to fix code style uses. In their repositories they also just listen to the push event (link).
Both orgs receive a lot of community contributions for forks. So this Action seems to work for them. 🤔
But I have to be honest: I haven't invested much time into this project in the last few weeks or even months. I just saw that the project is already being used by 60,000 repositories; my time investment doesn't give the usage justice.
In the next few weeks or months I would like to comb all issues and discussions and extract all relevant information and put that into the documentation and close/lock discussions with a link to the right place in the documentation.
I just saw that the project is already being used by 60,000 repositories; my time investment doesn't give the usage justice.
I have that with some OSS stuff over the years. It is hard to find time to maintain them, unless you can build something commercial on top of it.
I'm closing this issue.
Usage of this action in forks has been documented in the README. Thank you all for the feedback you've given in this thread.
git-auto-commit Version
v4
Machine Type
Ubuntu (eg. ubuntu-latest)
Bug description
A contributor has a fork branch called
contributor:card
and is trying to merge it in tolukepighetti:main
It appears that
git-auto-commit
is trying to commit tolukepighetti:card
instead ofcontributor:card
When new generated files are found and this action is triggered to commit the new files, I get the following error