Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/wpt-export |
| diff --git a/third_party/WebKit/Tools/Scripts/wpt-export b/third_party/WebKit/Tools/Scripts/wpt-export |
| index 0b3e4aee694825692f8b699990b2a31667c17373..e4a3e1ec8c7065f756aee0aedc765a358fc01899 100755 |
| --- a/third_party/WebKit/Tools/Scripts/wpt-export |
| +++ b/third_party/WebKit/Tools/Scripts/wpt-export |
| @@ -12,6 +12,7 @@ repository. |
| import argparse |
| import logging |
| +import json |
|
qyearsley
2017/02/07 19:32:16
Nit: sort import order
|
| from webkitpy.common.host import Host |
| from webkitpy.w3c.test_exporter import TestExporter |
| @@ -30,23 +31,33 @@ def main(): |
| help='See what would be done without actually creating or merging ' |
| 'any pull requests.') |
| parser.add_argument( |
| - '--user', |
| + '--gh-user', |
| help='GitHub user name. Can also be provided using the GH_USER ' |
| 'environment variable.') |
| parser.add_argument( |
| - '--token', |
| + '--gh-token', |
| help='GitHub token or password. Can also be provided using the GH_TOKEN ' |
| 'environment variable.') |
| + parser.add_argument( |
| + '--github-credentials-json', |
| + help='A JSON file with schema {"GH_USER": "", "GH_TOKEN": ""}.') |
|
qyearsley
2017/02/07 19:32:17
Optional: Note that this will override any other u
|
| args = parser.parse_args() |
| host = Host() |
| - if not args.user: |
| + |
| + if not args.gh_user: |
| args.user = host.environ.get('GH_USER') |
| - if not args.token: |
| - args.token = host.environ.get('GH_TOKEN') |
| - if not (args.user and args.token): |
| - parser.error('Must provide both user and token for GitHub.') |
| + if not args.gh_token: |
| + args.gh_token = host.environ.get('GH_TOKEN') |
| + if args.github_credentials_json: |
| + with open(args.github_credentials_json, 'r') as f: |
| + contents = json.load(f) |
| + args.gh_user = contents['GH_USER'] |
| + args.gh_token = contents['GH_TOKEN'] |
| + |
| + if not (args.gh_user and args.gh_token): |
| + parser.error('Must provide both gh_user and gh_token for GitHub.') |
| - wpt_github = WPTGitHub(host, args.user, args.token) |
| + wpt_github = WPTGitHub(host, args.gh_user, args.gh_token) |
| test_exporter = TestExporter(host, wpt_github, dry_run=args.dry_run) |
| test_exporter.run() |