-
Notifications
You must be signed in to change notification settings - Fork 364
Automate Code Review and Merge #32
Comments
This looks interesting. I'd like to work on this. I have never really done this thing before, so what do you recommend? Based on my minimal research, I assume I can use https://github.com/skygragon/leetcode-cli in a CI build somewhere. EDIT: On further looking, this requires a login. Though I think a manual check should be there before merging. |
@sadn1ck I assume that should work. @vJechsmayr Whats your take? |
@sadn1ck @yogeshsingh01 Please go ahead - about Automation or Travis CI I have no idea about it. Maybe @sadn1ck Is right and we should manual check before merging - but we can precheck and maybe comment if the Check on Leetcode was successful?! ("LeetCode Check Success - LeetCode Check Failed") |
I have a suggestion: we could have a staging branch where all pull requests are merged, and checked for correctness with the CLI in a GitHub workflow or travisCI pipeline. If any fail, we can reopen the issue, and have contributors work on it. After that, we can just have the staging branch merge into master every week or so, when every question passes. @yogeshsingh01 @vJechsmayr Thoughts? |
@sadn1ck I think the idea with the staging branch is great - For the merging staging to master it's important that only correct solutions (also with correct File-Names) passes the tests. |
@sadn1ck As leetcode has changed its policy, previously one can login via a config file. Hence, you can give Terminal LeetCode a try. To be precise, one have to implement something like this: In this they are syncing your leetcode progress, What we are focusing is just a part of that. Let me know if anything is not clear or if you need any help. |
I'll have a look, ty @yogeshsingh01 , swamped in college work right now. 😅 |
Hey, so I had a look at https://github.com/joshcai/leetcode-sync, so what I understood was that I have to send a request with the code to /problems/problem-name/submit, with the question id, language and code. (along with the CSRF Token and the leetcode session token) The previous endpoint doesn't actually return if it's accepted or not, so we have to make another request to /submissionid/check like it's done here. So, the basic workflow would be something like this,
The question right now I have is, how do I get the file which was added in the PR? And how do I create the check thingy? |
Great 👍
…On Tue, 6 Oct, 2020, 9:35 AM Anik Das, ***@***.***> wrote:
Hey, so I had a look at https://github.com/joshcai/leetcode-sync, so what
I understood was that I have to send a request with the code to
/problems/problem-name/submit, with the question id, language and code.
(along with the CSRF Token and the leetcode session token)
[image: image]
<https://user-images.githubusercontent.com/16396161/95157381-772fdd80-07b6-11eb-8e37-798a3ad84e74.png>
The previous endpoint doesn't actually return if it's accepted or not, so
we have to make another request to /submissionid/check like it's done here.
[image: image]
<https://user-images.githubusercontent.com/16396161/95157346-60898680-07b6-11eb-8629-23f7eef4e12a.png>
So, the basic workflow would be something like this,
- Get the file changed in PR
- Parse question id, and question name (name is a problem, might need
to change to actual name used in the URL by leetcode) from file name, and
the code from the contents of the file
- Send a request to the /submission endpoint
- Wait 1 second, and send a request to the /submissionid/check
endpoint to see if it is sucessful
- If successful, pass PR checks, if not, fail PR checks
The question right now I have is, how do I get the file which was added in
the PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZGE4NME5TUMGV26U2ZTUTSJKJSJANCNFSM4RTXNGGA>
.
|
@sadn1ck Wow thats great, Maybe we can find some answers in the github or github-actions API/FAQ how to access to the PR-File? |
@vJechsmayr Yeah I am currently scouring the docs, if I find something I will let you know. If you find something, do let me know as well. Also, do we have a gitter or a communication app of some sort? It would simplify collaboration, is all. 😅 |
He is git api to find list of files
"GET /repos/:owner/:repo/pulls/:pull_number/files"
Check following link for further reference
https://developer.github.com/v3/pulls/#list-pull-requests-files
Sorry, currently busy in work. Else would have done it.
I hope these link will help.
…On Tue, 6 Oct, 2020, 11:36 AM Anik Das, ***@***.***> wrote:
@vJechsmayr <https://github.com/vJechsmayr> Yeah I am currently scouring
the docs, if I find something I will let you know. If you find something,
do let me know as well.
Also, do we have a gitter or a communication app of some sort? It would
simplify collaboration, is all. 😅
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZGE4LPLMUYWJ7EFF3YDS3SJKXWDANCNFSM4RTXNGGA>
.
|
Great! I'll start on it as soon as I can. |
I tested the LeetCode Sync Action on my other Repo - to see how it works: It syncs the submitted Problems FROM LeetCode TO Github - not the other way 😢 I'm back in 9h - go to work now 😸 |
I'm almost new to gitter Gitter (just used it 2-3 times) to I hope that community I created will help? I'm open for suggestions 😸 |
Yeah I just looked at the repo for the how the requests are sent (the params and endpoints). Here, I will write a script which uses that, and which runs in the workflow, and sends some API calls to leetcode. Hoping the script method will work haha. |
https://github.com/sadn1ck/PythonAlgorithms/commit/8ff18feb561183a69a7ac78a378d22970c86b76f I have made a commit, with the base of the script setup, I am able to craft the request, but on POSTing, I get a 500 server error. :| (for testing locally, just set the sample.env values) |
I am unable to understand, what is error. Could you provide some more information. @sadn1ck |
So basically I made the request how it happens when you click submit in leetcode, but I get an internal server error when I actually make the request. Sometimes I get 429, and sometimes 500 status codes. @yogeshsingh01 You can join the gitter above, easier to talk 😃 Gitter Link |
@vJechsmayr @sadn1ck Bot is working perfectly. |
Great!!! Nice one @yogeshsingh01 !! |
Uh oh!
There was an error while loading. Please reload this page.
Code Review
Code Review should be automated
It is an enhancement
Expected behaviour
If someone request a pull request, bot will automatically check solution on LeetCode, if it work fine then it should merge.
The text was updated successfully, but these errors were encountered: