-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add split workflow, allowing the action to be used in PRs created from forks #50
Add split workflow, allowing the action to be used in PRs created from forks #50
Conversation
@FlorianReimold This is now in a workable state, I've confirmed this works in a way that would work for me in my projects that get a lot of pull requests from forks. How it's actually implemented right now with a mix of other github-script actions and what-not is not really how I envision it looking when this PR gets its final polish, but it's ready to be played with at least! |
@pajlada: Thanks for this gigantic PR! I am going to test out your clang-tidy-review version as soon as possible and report back in the next days! |
I gave it a rough test. It worked. I would totally use it in the exact state it is in. What I still have noticed:
|
Thanks @pajlada for this, and also @FlorianReimold for testing it! Florian's second point is quite important -- some people like to use the action as pass/fail rather than just comments, so it's important to get that working. My main suggestion is to undo the move of
Admittedly it would involve writing some javascript, but it should just be able to use the github octokit library to upload the comments straight from the json file |
Thank for your feedback folks! I will look to make the requested changes this weekend and add some overall polish Non-exhaustive list for myself:
This is actually on purpose, the way to escalate and get permissions is through |
Just to give you my opinion on the javascript post-comments workflow: Honestly, I wouldn't care too much about that. The current python3-docker based version completes in about 60 seconds, which is totally reasonable. (Also I don't know javascript 😉) Example run: https://github.com/FlorianReimold/ecal-test-snapshot/actions/runs/2868416302 |
18d82c4
to
a428a23
Compare
a428a23
to
93493d8
Compare
0a36e9c
to
3b11695
Compare
47fb6c6
to
4b1cd0d
Compare
To begin, sorry for the big PR! After 49 force pushes I believe I've done all I can to make it as easy to review as possible. It's now in a state that I'm happy with, so I believe there's just a few things left. Move all shared logic from review.py into the clang_tidy_review library This commit only moves code and is the biggest contributor to the final lines added/removed. What I have not done, is convert the
The workflow necessary to download/upload the artifact is still ugly right now, but this can be improved in python by making REST API requests ourselves (not relying on PyGithub) Questions:
|
9dca715
to
ed6c910
Compare
First of all I would also prefer |
I like that naming idea a lot, makes it more of a conscious choice in my head that you are going to be using the action in an entirely different way |
+1 for Leaving the workflow as Python for now seems like the sensible way forward, and maybe I'll look at converting it to javascript in future |
rm -rf apt cache dir to make container slightly smaller Add workdir to help debugging locally
ed6c910
to
39d926a
Compare
Hey everybody, we don't want this PR to die, right? 😊 Are we waiting for me to approve the current workflow again? I can try it out and see if I find issues or room for improvements! 👍 |
I've been a bit busy on other work recently, I think this PR is in a pretty good state and I've been testing it with pull requests in this repo It runs into some undiscoverable issues sometimes where the split workflow fails because the artifact uploading failed - I'm not sure how this could be made more discoverable, but it could be handled better. The workflows I'm running now: |
I'm very busy this week, but I'll try and have a proper look when I can |
Hm maybe you could just always create a file, even if it is empty? The download should then more or less never fail, just because there should always be a file present 🤔 |
Thanks @pajlada and @FlorianReimold for writing and testing this! I haven't yet found a good way of testing this Action except manually, so I really appreciate the effort you've both put in. I'm going to merge this now so that other people can start using it. |
You can use this now in v0.10.0 |
Why
python:3
docker base image?For the
post_comments
workflow, I've decided to use thepython:3
docker image from dockerhub.This image is based off of debian.
Because no system binaries are run other than python, I don't expect any issues with the Ubuntu <-> Debian jump. Being able to skip any
apt
calls speeds up the workflow by a good chunk.What's changed
A lot of the code from
review.py
has been moved to a packageclang_tidy_review
stored in the path/post_comments/clang_tidy_review
- this is to ensure the package can be used by both the review and post_comments workflows.The main workflow Dockerfile has been updated to include the
post_comments
directory, this is done to include the shared library contained within that directoryThe main workflow has a new input:
post_comments
.This input controls whether comments should be posted by this workflow or not.
Action item: Does this input name accurately describe its functionality?
README.md
page to describe how and why to use the split workflowFixes #49
Example PR showing the error annotation: pajlads/test-cpp-project#2 - it's not showing up straight in the PR page because it's not linked to a file, rather you need to click details on the failed action. If this is something we very much want we could potentially use the first file from the review that was about to be posted to have it show up more like a PR comment
This PR is hefty, and contains a lot of different things done in the same PR. I'd suggest this is either squash & merged, or let me know and I'll clean up the commits to more manageable pieces before it gets merged in.
Looking forward to hear your feedback!
To test this right now, you can point your action at my fork like done in my test project: https://github.com/pajlada/mini-cpp-project/blob/master/.github/workflows/build.yml and https://github.com/pajlada/mini-cpp-project/blob/master/.github/workflows/post_comments.yml
The downloading and uploading of artifacts could be done by just using the raw github api using the requests library, which would make it a lot cleaner to use the split workflow.