RESOLVED FIXED 192227
Add script to automatically close GitHub pull requests
https://bugs.webkit.org/show_bug.cgi?id=192227
Summary Add script to automatically close GitHub pull requests
Michael Catanzaro
Reported 2018-11-30 07:36:51 PST
This script will close all open pull requests at https://github.com/WebKit/webkit with a friendly message: """ Thank you for your interest in contributing to WebKit! This repository is a mirror and does not accept pull requests. Please submit your contribution to [WebKit Bugzilla](https://bugs.webkit.org/) for code review. Please also read [Contributing Code](https://webkit.org/contributing-code/) for an introduction to the contribution process. We apologize for the inconvenience and hope to see you on WebKit Bugzilla soon! """ If we run the script on a daily basis, then potential contributors can be redirected to Bugzilla in a timely manner, instead of getting frustrated that their pull requests were ignored until somebody notices them weeks later. We have two options to run it: (a) I could configure it to run nightly on my personal VPS, if Jon is OK with granting my GitHub account access to the WebKit repo. (b) Apple could run it on Apple infrastructure, if someone from Apple wants to manage this. If we do (b) then the script should be rewritten in python2 instead of python3. (The configparser syntax is different enough that it's easier to support only one python version.)
Attachments
Patch (4.82 KB, patch)
2018-11-30 07:40 PST, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2018-11-30 07:40:14 PST
Don Olmstead
Comment 2 2018-11-30 09:07:01 PST
The script itself is fine but there's a GitHub app that looks like it would fit the bill. https://probot.github.io/apps/close-issue/
Michael Catanzaro
Comment 3 2018-11-30 09:10:48 PST
(In reply to Don Olmstead from comment #2) > The script itself is fine but there's a GitHub app that looks like it would > fit the bill. > > https://probot.github.io/apps/close-issue/ Not clear if that can close pull requests? Doesn't look like it?
Don Olmstead
Comment 4 2018-11-30 09:30:48 PST
Comment on attachment 356176 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=356176&action=review > Tools/Scripts/close-pull-requests:77 > + issue = github.Issue.Issue(requester=req._requester, > + headers={}, > + attributes=issue_data, > + completed=True) I had thought all PRs are technically issues. So you could just try installing it on a dummy repo and see what happens.
Don Olmstead
Comment 5 2018-11-30 09:32:16 PST
So to be clear I think the script is perfectly fine as is the only reason I bring up the Close Issue Probot is the whole hosting issue. https://github.com/offu/close-issue-app is the source for it so if it doesn't fit the bill maybe we can extend it and do a PR on it.
Michael Catanzaro
Comment 6 2018-12-01 08:41:45 PST
(In reply to Don Olmstead from comment #5) > So to be clear I think the script is perfectly fine as is the only reason I > bring up the Close Issue Probot is the whole hosting issue. > > https://github.com/offu/close-issue-app is the source for it so if it > doesn't fit the bill maybe we can extend it and do a PR on it. I'm fine with using that app if that's what we want to do. I'd hesitate to give an app access to my own GitHub account, though.
Alexey Proskuryakov
Comment 7 2018-12-03 10:41:46 PST
Not maintaining a service that runs scripts seems better than maintaining it. Can we have a separate GitHub account for the app?
Don Olmstead
Comment 8 2018-12-03 10:45:51 PST
(In reply to Alexey Proskuryakov from comment #7) > Not maintaining a service that runs scripts seems better than maintaining > it. Can we have a separate GitHub account for the app? Someone who has org access to WebKit on GitHub would need to enable it. When enabling it it will ask permissions for things. If the permissions it asks for are ok then it should just work.
Michael Catanzaro
Comment 9 2018-12-03 11:58:08 PST
(In reply to Don Olmstead from comment #8) > Someone who has org access to WebKit on GitHub would need to enable it. Of the five people who have access, the only name I recognize is Jon (CCed).
Michael Catanzaro
Comment 10 2019-01-01 12:02:53 PST
Anyway, I can have this dumb little script running immediately if we make the decision to go that route, if I'm granted access to the GitHub repo. If we want to use the app, someone else will have to take charge. Either way, it's blocked on Jon Davis since he's the only current contributor with access to the GitHub repo.
Michael Catanzaro
Comment 11 2019-05-06 19:03:00 PDT
Ping: Jon.
Michael Catanzaro
Comment 12 2019-05-10 08:56:17 PDT
(In reply to Michael Catanzaro from comment #0) > (a) I could configure it to run nightly on my personal VPS, if Jon is OK > with granting my GitHub account access to the WebKit repo. I actually no longer have a personal VPS, but Igalia could set this up easily enough. I'm sure Apple could, too.
Michael Catanzaro
Comment 13 2019-06-06 06:26:49 PDT
I tried emailing, Jon but I think he missed it. We really need a response from Jon here, as he's the only Apple developer who controls the GitHub repo. It would be embarrassing to have to ask old Google developers for help with WebKit's GitHub repo. ;)
Ryosuke Niwa
Comment 14 2019-06-26 19:04:22 PDT
What do we need to do in the Github repo / account??
Michael Catanzaro
Comment 15 2019-06-27 07:31:36 PDT
To use my script, we would need a GitHub access token for an account with access to the GitHub repo. We could create a new GitHub account for this purpose, give it access to the WebKit repo, and then create an access token for it. Access tokens are created under GitHub settings -> Developer settings -> Access tokens. I've tested this already and the only permission required is the public_repo permission; everything else can be unchecked. Then we would need to set up a server to run the script on a regular basis (e.g. daily). You could do that at Apple or we could do it at Igalia, whichever you would prefer. We could alternatively forget about my script and try setting up https://github.com/offu/close-issue-app instead, as Don suggested. That may or may not be easier. Either way, we need help from someone with access to the GitHub repo (Jon or Ryosuke).
Ryosuke Niwa
Comment 16 2019-06-27 19:00:45 PDT
We should probably also lock the conversation if we can. I had to lock the conversation on https://github.com/WebKit/webkit/pull/20 even after closing PR because the person kept commenting on it.
Michael Catanzaro
Comment 17 2019-06-28 08:10:27 PDT
Comment on attachment 356176 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=356176&action=review > Tools/Scripts/close-pull-requests:79 > + issue.create_comment(MESSAGE) > + req.edit(state='closed') Not tested, but I think we would just need to do: issue.lock('resolved') Python API docs: https://pygithub.readthedocs.io/en/latest/github_objects/Issue.html?highlight=lock#github.Issue.Issue.lock GitHub docs: https://developer.github.com/v3/issues/#lock-an-issue In particular, note the 'resolved' string is important and the lock will fail if we don't have it there.
Jon Davis
Comment 18 2019-07-10 11:33:01 PDT
I've setup an instance of this script to run daily at around 9 AM on an internal instance at Apple.
Michael Catanzaro
Comment 19 2019-07-10 11:45:02 PDT
Awesome, thanks Jon! I'll close this, I suppose. We can still commit it to Tools/Scripts if we want, but doesn't seem necessary.
Note You need to log in before you can comment on or make changes to this bug.