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

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

Issue 2719173002: [WPT Export] Require GitHub API token in WPT remote origin URL (Closed)
Patch Set: Remove --depth, make LocalWPT.gh_token optional Created 3 years, 9 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 | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py ('k') | 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 json 14 import json
15 import logging 15 import logging
16 16
17 from webkitpy.common.host import Host 17 from webkitpy.common.host import Host
18 from webkitpy.w3c.test_exporter import TestExporter 18 from webkitpy.w3c.test_exporter import TestExporter
19 from webkitpy.w3c.wpt_github import WPTGitHub
20 19
21 20
22 _log = logging.getLogger(__name__) 21 _log = logging.getLogger(__name__)
23 22
24 23
25 def main(): 24 def main():
26 logging.basicConfig(level=logging.INFO, format='%(message)s') 25 logging.basicConfig(level=logging.INFO, format='%(message)s')
27 26
28 parser = argparse.ArgumentParser(description=__doc__) 27 parser = argparse.ArgumentParser(description=__doc__)
29 parser.add_argument( 28 parser.add_argument(
30 '--dry-run', action='store_true', 29 '--dry-run', action='store_true',
31 help='See what would be done without actually creating or merging ' 30 help='See what would be done without actually creating or merging '
32 'any pull requests.') 31 'any pull requests.')
33 parser.add_argument( 32 parser.add_argument(
34 '--gh-user', 33 '--gh-user',
35 help='GitHub user name. Can also be provided using the GH_USER ' 34 help='GitHub user name. Can also be provided using the GH_USER '
36 'environment variable.') 35 'environment variable.')
37 parser.add_argument( 36 parser.add_argument(
38 '--gh-token', 37 '--gh-token',
39 help='GitHub token or password. Can also be provided using the GH_TOKEN ' 38 help='GitHub token or password. Can also be provided using the GH_TOKEN '
40 'environment variable.') 39 'environment variable.')
41 parser.add_argument( 40 parser.add_argument(
42 '--github-credentials-json', 41 '--github-credentials-json',
43 help='A JSON file with schema {"GH_USER": "", "GH_TOKEN": ""}. ' 42 help='A JSON file with schema {"GH_USER": "", "GH_TOKEN": ""}. '
44 'This will override credentials that were passed via command line o r env var.') 43 'This will override credentials that were passed via command line o r env var.')
45 args = parser.parse_args() 44 args = parser.parse_args()
46 host = Host() 45 host = Host()
46 gh_user = args.gh_user
47 gh_token = args.gh_token
47 48
48 if not args.gh_user: 49 if not gh_user:
49 args.gh_user = host.environ.get('GH_USER') 50 gh_user = host.environ.get('GH_USER')
50 if not args.gh_token: 51 if not gh_token:
51 args.gh_token = host.environ.get('GH_TOKEN') 52 gh_token = host.environ.get('GH_TOKEN')
52 if args.github_credentials_json: 53 if args.github_credentials_json:
53 with open(args.github_credentials_json, 'r') as f: 54 with open(args.github_credentials_json, 'r') as f:
54 contents = json.load(f) 55 contents = json.load(f)
55 args.gh_user = contents['GH_USER'] 56 gh_user = contents['GH_USER']
56 args.gh_token = contents['GH_TOKEN'] 57 gh_token = contents['GH_TOKEN']
57 58
58 if not (args.gh_user and args.gh_token): 59 if not (gh_user and gh_token):
59 parser.error('Must provide both gh_user and gh_token for GitHub.') 60 parser.error('Must provide both gh_user and gh_token for GitHub.')
60 61
61 wpt_github = WPTGitHub(host, args.gh_user, args.gh_token) 62 TestExporter(host, gh_user, gh_token, dry_run=args.dry_run).run()
62 test_exporter = TestExporter(host, wpt_github, dry_run=args.dry_run)
63
64 test_exporter.run()
65 63
66 64
67 if __name__ == '__main__': 65 if __name__ == '__main__':
68 main() 66 main()
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698