Summary: | Add script to automatically close GitHub pull requests | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> | ||||
Component: | Tools / Tests | Assignee: | Michael Catanzaro <mcatanzaro> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | dbates, dean_johnson, dino, don.olmstead, jond, lforschler, mcatanzaro, mjs, rniwa | ||||
Priority: | P2 | ||||||
Version: | WebKit Nightly Build | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Attachments: |
|
Description
Michael Catanzaro
2018-11-30 07:36:51 PST
Created attachment 356176 [details]
Patch
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/ (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? 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. 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. (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. Not maintaining a service that runs scripts seems better than maintaining it. Can we have a separate GitHub account for the app? (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. (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). 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. Ping: Jon. (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. 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. ;) What do we need to do in the Github repo / account?? 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). 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. 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. I've setup an instance of this script to run daily at around 9 AM on an internal instance at Apple. 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. |