WebKit Bugzilla
Attachment 356176 Details for
Bug 192227
: Add script to automatically close GitHub pull requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192227-20181130094013.patch (text/plain), 4.82 KB, created by
Michael Catanzaro
on 2018-11-30 07:40:14 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Michael Catanzaro
Created:
2018-11-30 07:40:14 PST
Size:
4.82 KB
patch
obsolete
>Subversion Revision: 238670 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 67489f269084b5f5c84e45431b780b0fec9e63c9..246ea6fea24ee27179727d5a61fa425213603fb9 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2018-11-30 Michael Catanzaro <mcatanzaro@igalia.com> >+ >+ Add script to automatically close GitHub pull requests >+ https://bugs.webkit.org/show_bug.cgi?id=192227 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This script will close all open pull requests at https://github.com/WebKit/webkit with a >+ friendly message. 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. >+ >+ * Scripts/close-pull-requests: Added. >+ > 2018-11-28 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOSMac] Dropping text selections from web content into editable elements crashes the web process >diff --git a/Tools/Scripts/close-pull-requests b/Tools/Scripts/close-pull-requests >new file mode 100755 >index 0000000000000000000000000000000000000000..5d4f56da769461b23eb3f813b9b8aafe482bff9f >--- /dev/null >+++ b/Tools/Scripts/close-pull-requests >@@ -0,0 +1,79 @@ >+#!/usr/bin/env python3 >+# >+# Copyright (C) 2018 Igalia S.L. >+# Copyright (C) 2018 Metrological Group B.V. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+# This script exists to close all open pull requests at >+# https://github.com/WebKit/webkit >+# >+# It is based on a much more sophisticated script: >+# https://gitlab.gnome.org/Infrastructure/sysadmin-bin/blob/master/close_pull_requests.py >+# We have permission from the author to use it with a BSD license: >+# https://gitlab.gnome.org/Infrastructure/sysadmin-bin/issues/12 >+# >+# To use this script you must create a github.oauth in the cwd you will >+# execute the script from. Its contents should look like this: >+# >+# [github] >+# oauth_token = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >+# >+# with the 'a's replaced by a GitHub access token. Of course the access token >+# should provide access to an account with write access to WebKit's GitHub fork. >+ >+import configparser >+import github >+import os >+import sys >+ >+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! >+""" >+ >+config_file = 'github.oauth' >+if not os.path.isfile(config_file): >+ print('No configuration file could be found at %s' % config_file) >+ sys.exit(1) >+ >+config = configparser.ConfigParser() >+config.read_file(open(config_file)) >+ >+if config.has_option('github', 'oauth_token'): >+ auth_token = config.get('github', 'oauth_token') >+else: >+ print('Make sure %s has a github section and an oauth_token key/value pair' % config_file) >+ sys.exit(1) >+ >+ghub = github.Github(auth_token) >+repo = ghub.get_organization('WebKit').get_repo('webkit') >+ >+# Close each pull request >+pull_requests = repo.get_pulls('open') >+for req in pull_requests: >+ issue_data = {'url': repo.url + '/issues/' + str(req.number)} >+ issue = github.Issue.Issue(requester=req._requester, >+ headers={}, >+ attributes=issue_data, >+ completed=True) >+ issue.create_comment(MESSAGE) >+ req.edit(state='closed')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192227
: 356176