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

Unified Diff: third_party/WebKit/Tools/Scripts/wpt-export

Issue 2685673002: [WPT Export] Add ability to pass GitHub creds as JSON file (Closed)
Patch Set: Address CL feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f9b3f2bf83a67f15aab5ba038e4ace08235bede1 100755
--- a/third_party/WebKit/Tools/Scripts/wpt-export
+++ b/third_party/WebKit/Tools/Scripts/wpt-export
@@ -11,6 +11,7 @@ repository.
"""
import argparse
+import json
import logging
from webkitpy.common.host import Host
@@ -30,23 +31,34 @@ 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": ""}. '
+ 'This will override credentials that were passed via command line or env var.')
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()
« 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