Revision 387fba3809b776a98e6b11725c6d9a5be037bbca authored by Darren Shen on 11 April 2018, 05:55:17 UTC, committed by Blink WPT Bot on 11 April 2018, 06:04:09 UTC
Test failures: - scroll-snap-align should always compute to a pair (but we currently compute to single keyword if specified). - scroll-snap-type should compute to as specified (but we currently compute to pair). Bug: 820299 Change-Id: Id38cee967daef8ac5c0658b958d6e74445035a83 Reviewed-on: https://chromium-review.googlesource.com/999078 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Darren Shen <shend@chromium.org> Cr-Commit-Position: refs/heads/master@{#549778}
1 parent 2e8fa7b
tag_master.py
import base64
import json
import logging
import os
import sys
import urllib2
here = os.path.abspath(os.path.dirname(__file__))
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
if not(wpt_root in sys.path):
sys.path.append(wpt_root)
from tools.wpt.testfiles import get_git_cmd
logging.basicConfig()
logger = logging.getLogger(__name__)
def get_pr(repo, owner, rev):
url = ("https://api.github.com/search/issues?q=type:pr+is:merged+repo:%s/%s+%s" %
(repo, owner, rev))
try:
resp = urllib2.urlopen(url)
except Exception as e:
logger.error(e)
return None
if resp.code != 200:
logger.error("Got HTTP status %s" % resp.code)
return None
try:
data = json.loads(resp.read())
except ValueError:
logger.error("Failed to read response as JSON")
return None
items = data["items"]
if len(items) == 0:
logger.error("No PR found for master")
return None
if len(items) > 1:
logger.warning("Found multiple PRs for master")
pr = items[0]
return pr["number"]
def tag(repo, owner, sha, tag):
data = json.dumps({"ref": "refs/tags/%s" % tag,
"sha": sha})
try:
url = "https://api.github.com/repos/%s/%s/git/refs" % (repo, owner)
req = urllib2.Request(url, data=data)
base64string = base64.b64encode('%s' % (os.environ["GH_TOKEN"]))
req.add_header("Authorization", "Basic %s" % base64string)
opener = urllib2.build_opener(urllib2.HTTPSHandler())
resp = opener.open(req)
except Exception as e:
logger.error("Tag creation failed:\n%s" % e)
return
if resp.code != 201:
logger.error("Got HTTP status %s" % resp.code)
else:
logger.info("Tagged master as %s" % tag)
def main():
owner, repo = os.environ["TRAVIS_REPO_SLUG"].split("/", 1)
if os.environ["TRAVIS_PULL_REQUEST"] != "false":
logger.info("Not tagging for PR")
return
if os.environ["TRAVIS_BRANCH"] != "master":
logger.info("Not tagging for non-master branch")
return
git = get_git_cmd(wpt_root)
head_rev = git("rev-parse", "HEAD")
pr = get_pr(owner, repo, head_rev)
if pr is not None:
tag(owner, repo, head_rev, "merge_pr_%s" % pr)
if __name__ == "__main__":
main()
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...