-
Notifications
You must be signed in to change notification settings - Fork 67
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
Better documentation and/or handling of forks #53
Comments
Wow, thanks so much for your detailed assessment here @bazzadp ! I agree with pretty much everything you've said, including the "right" ways to handle this. I think the original GitHub actions documentation that this was built against didn't include anything about forks, but even if it did, it totally wasn't a consideration that was made.
That would be fantastic.
This would be a better and safer default 👍 If you've got the capacity to pick this up as well, I'd appreciate it.
I agree, that's too much and it's just too hard.
Maybe so, although I have concerns that this makes it too easy for people to blindly trust this against their master branch. I'd prefer to not make that easy to do.
I think this would be a good improvement. I'm certain there are people who could benefit from being able to run image-actions as part of their CI (and I know that @chabad360 was aiming at this workflow too). If this were a configurable option where people could choose their preferred behavior I'd be all in support of that. 👍 As I mentioned earlier if you've the capacity to help with all or some of these items it'd be really appreciated. Otherwise feel free to extract them as separate issues so we can track against them. Thanks again ✨ |
Cool. Will have a look. |
According to the GitHub actions environment variable docs, |
OK, but what does that matter? It's easy to stop this running for forks by adding this to the Action YML as suggested in the PR:
The issue is I want this to run after forks are merged. |
I was just leaving notes, more than anything else 😄 |
Folks, thank you very much this amazing action and the very informative discussion. However, I still have a question. If someone forks my repo, then the forked repo has this action as well. In this case, isn't the action supposed to run on the forked repo while performing the pull request back to the original repo? I'm sorry if I was too confusing or if I missed something. |
What I do is:
I documented that here: https://github.com/calibreapp/image-actions#process-pull-requests-from-forked-repositories And if curious to see a real-life implementation of this, then look at this workflow: https://github.com/HTTPArchive/almanac.httparchive.org/blob/main/.github/workflows/compress-images.yml |
First up, thanks for the excellent GitHub action!
However, I was surprised recently to find this doesn't work on pull requests from forks and fails silently, with only this error message hidden in the GitHub action logs to indicate it didn't complete:
Digging into GitHub actions I understand why – because upstream repos don't have access to change downstream branches – and on second look, I did find this mentioned on the README:
However this was not clear to me, and imagine it isn't to others either and accepting pull requests from forks is really what GitHub is all about.
I've a few suggestions to improve this:
Making people more aware of this restriction
First of all I would suggest expanding on that line in the README to explain what it means to forks. I'm happy to throw in a suggested pull request with wording for this if you'd like?
We could also add advice to only run this GitHub action on pull requests from and to the same repo, as pointless run other than that so a waste of time and compute. Not sure exactly how to do this but happy to look into the appropriate
if:
line to add to the suggested .yml config if you want?How can we fix this?
I presume getting forked repos to implement a Personal Access Token would work, but not sure that's a great idea to be honest. It only works for regular contributors who will go to this effort of setting up a PAT – and regular contributors might as well work off of the main repo.
A better option might be to allow the action to also run on pushes. Then could run it on master after the PR has been approved. Ideally that would allow the option to commit directly to the push branch (master in this case - for those that are crazy enough to want that) or to open a new pull request with the compressed images after merging (probably better!).
Alternatively changing the action to only do the compression, and not handle the commit, would allow the Checkout GitHub Action to handle the commit (though this does an extra config line to checkout the correct head branch), or something like the Create Pull Request GitHub Action to create a new pull request, after merging pull requests from forks. Might mean less code for you to maintain, more flexibility, but at the cost of more complicated workflow set up. Or alternatively make this optional for those (like me!) that want the power of handling the commit differently. Probably need to do that to maintain backwards compatibility to be honest.
Anyway, quite a lot in there, so maybe better split into a number of issues but thought best to start a discussion first so let me know your thoughts.
The text was updated successfully, but these errors were encountered: