Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: third_party/WebKit/Tools/Scripts/wpt-export

Issue 2685673002: [WPT Export] Add ability to pass GitHub creds as JSON file (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Exports local changes to web-platform-tests in Chromium to upstream repo. 6 """Exports local changes to web-platform-tests in Chromium to upstream repo.
7 7
8 This script checks LayoutTests/external/wpt for changes that can be exported, 8 This script checks LayoutTests/external/wpt for changes that can be exported,
9 then creates a patch, and creates and lands a pull request for the upstream 9 then creates a patch, and creates and lands a pull request for the upstream
10 repository. 10 repository.
11 """ 11 """
12 12
13 import argparse 13 import argparse
14 import logging 14 import logging
15 import json
qyearsley 2017/02/07 19:32:16 Nit: sort import order
15 16
16 from webkitpy.common.host import Host 17 from webkitpy.common.host import Host
17 from webkitpy.w3c.test_exporter import TestExporter 18 from webkitpy.w3c.test_exporter import TestExporter
18 from webkitpy.w3c.wpt_github import WPTGitHub 19 from webkitpy.w3c.wpt_github import WPTGitHub
19 20
20 21
21 _log = logging.getLogger(__name__) 22 _log = logging.getLogger(__name__)
22 23
23 24
24 def main(): 25 def main():
25 logging.basicConfig(level=logging.INFO, format='%(message)s') 26 logging.basicConfig(level=logging.INFO, format='%(message)s')
26 27
27 parser = argparse.ArgumentParser(description=__doc__) 28 parser = argparse.ArgumentParser(description=__doc__)
28 parser.add_argument( 29 parser.add_argument(
29 '--dry-run', action='store_true', 30 '--dry-run', action='store_true',
30 help='See what would be done without actually creating or merging ' 31 help='See what would be done without actually creating or merging '
31 'any pull requests.') 32 'any pull requests.')
32 parser.add_argument( 33 parser.add_argument(
33 '--user', 34 '--gh-user',
34 help='GitHub user name. Can also be provided using the GH_USER ' 35 help='GitHub user name. Can also be provided using the GH_USER '
35 'environment variable.') 36 'environment variable.')
36 parser.add_argument( 37 parser.add_argument(
37 '--token', 38 '--gh-token',
38 help='GitHub token or password. Can also be provided using the GH_TOKEN ' 39 help='GitHub token or password. Can also be provided using the GH_TOKEN '
39 'environment variable.') 40 'environment variable.')
41 parser.add_argument(
42 '--github-credentials-json',
43 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
40 args = parser.parse_args() 44 args = parser.parse_args()
41 host = Host() 45 host = Host()
42 if not args.user: 46
47 if not args.gh_user:
43 args.user = host.environ.get('GH_USER') 48 args.user = host.environ.get('GH_USER')
44 if not args.token: 49 if not args.gh_token:
45 args.token = host.environ.get('GH_TOKEN') 50 args.gh_token = host.environ.get('GH_TOKEN')
46 if not (args.user and args.token): 51 if args.github_credentials_json:
47 parser.error('Must provide both user and token for GitHub.') 52 with open(args.github_credentials_json, 'r') as f:
53 contents = json.load(f)
54 args.gh_user = contents['GH_USER']
55 args.gh_token = contents['GH_TOKEN']
48 56
49 wpt_github = WPTGitHub(host, args.user, args.token) 57 if not (args.gh_user and args.gh_token):
58 parser.error('Must provide both gh_user and gh_token for GitHub.')
59
60 wpt_github = WPTGitHub(host, args.gh_user, args.gh_token)
50 test_exporter = TestExporter(host, wpt_github, dry_run=args.dry_run) 61 test_exporter = TestExporter(host, wpt_github, dry_run=args.dry_run)
51 62
52 test_exporter.run() 63 test_exporter.run()
53 64
54 65
55 if __name__ == '__main__': 66 if __name__ == '__main__':
56 main() 67 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698