Ejemplo n.º 1
0
def main():
    repo_key = "GITHUB_REPOSITORY"

    if not should_run_action():
        return

    owner, repo = os.environ[repo_key].split("/", 1)

    git = get_git_cmd(wpt_root)
    head_rev = git("rev-parse", "HEAD")

    pr = get_pr(owner, repo, head_rev)
    if pr is None:
        # This should only really happen during testing
        tag_name = "merge_commit_%s" % head_rev
    else:
        tag_name = "merge_pr_%s" % pr

    tagged = tag(owner, repo, head_rev, tag_name)
    if not tagged:
        sys.exit(1)

    summary = git("show", "--no-patch", '--format="%s"', "HEAD")
    body = git("show", "--no-patch", '--format="%b"', "HEAD")

    if not create_release(owner, repo, head_rev, tag_name, summary, body):
        sys.exit(1)
Ejemplo n.º 2
0
def main():
    dry_run = should_dry_run()

    manifest_path = os.path.join(tempfile.mkdtemp(), "MANIFEST.json")

    create_manifest(manifest_path)

    compress_manifest(manifest_path)

    owner, repo = os.environ["GITHUB_REPOSITORY"].split("/", 1)

    git = get_git_cmd(wpt_root)
    head_rev = git("rev-parse", "HEAD").strip()
    body = git("show", "--no-patch", "--format=%B", "HEAD")

    if dry_run:
        return Status.SUCCESS

    pr = get_pr(owner, repo, head_rev)
    if pr is None:
        return Status.FAIL
    tag_name = "merge_pr_%s" % pr

    if not create_release(manifest_path, owner, repo, head_rev, tag_name,
                          body):
        return Status.FAIL

    return Status.SUCCESS
Ejemplo n.º 3
0
def main():
    repo_key = "GITHUB_REPOSITORY"

    if not should_run_action():
        return Status.NEUTRAL

    owner, repo = os.environ[repo_key].split("/", 1)

    git = get_git_cmd(wpt_root)
    head_rev = git("rev-parse", "HEAD")

    pr = get_pr(owner, repo, head_rev)
    if pr is None:
        return Status.FAIL
    tag_name = "merge_pr_%s" % pr

    manifest_path = os.path.expanduser(os.path.join("~", "meta", "MANIFEST.json"))

    os.makedirs(os.path.dirname(manifest_path))

    create_manifest(manifest_path)

    compress_manifest(manifest_path)

    tagged = tag(owner, repo, head_rev, tag_name)
    if not tagged:
        return Status.FAIL

    summary = git("show", "--no-patch", '--format="%s"', "HEAD")
    body = git("show", "--no-patch", '--format="%b"', "HEAD")

    if not create_release(manifest_path, owner, repo, head_rev, tag_name, summary, body):
        return Status.FAIL

    return Status.SUCCESS
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def get_tagged_revisions(pattern):
    # type: (bytes) -> List[..., Dict]
    '''
    Returns the tagged revisions indexed by the committer date.
    '''
    git = get_git_cmd(wpt_root)
    args = [
        pattern, '--sort=-committerdate',
        '--format=%(refname:lstrip=2) %(objectname) %(committerdate:raw)',
        '--count=100000'
    ]
    for line in git("for-each-ref", *args).splitlines():
        tag, commit, date, _ = line.split(" ")
        date = int(date)
        yield tag, commit, date
Ejemplo n.º 6
0
def get_tagged_revisions(pattern: str) -> Iterator[Tuple[str, str, int]]:
    '''
    Iterates the tagged revisions as (tag name, commit sha, committer date) tuples.
    '''
    git = get_git_cmd(wpt_root)
    args = [
        pattern, u'--sort=-committerdate',
        u'--format=%(refname:lstrip=2) %(objectname) %(committerdate:raw)',
        u'--count=100000'
    ]
    ref_list = git("for-each-ref", *args)  # type: ignore
    for line in ref_list.splitlines():
        if not line:
            continue
        tag, commit, date, _ = line.split(" ")
        date = int(date)
        yield tag, commit, date
Ejemplo n.º 7
0
def main():
    repo_key = "GITHUB_REPOSITORY"

    if not should_run_action():
        return Status.NEUTRAL

    owner, repo = os.environ[repo_key].split("/", 1)

    git = get_git_cmd(wpt_root)
    head_rev = git("rev-parse", "HEAD")

    pr = get_pr(owner, repo, head_rev)
    if pr is None:
        # This should only really happen during testing
        tag_name = "merge_commit_%s" % head_rev
    else:
        tag_name = "merge_pr_%s" % pr

    manifest_path = os.path.expanduser(os.path.join("~", "meta", "MANIFEST.json"))

    os.makedirs(os.path.dirname(manifest_path))

    create_manifest(manifest_path)

    compress_manifest(manifest_path)

    tagged = tag(owner, repo, head_rev, tag_name)
    if not tagged:
        return Status.FAIL

    summary = git("show", "--no-patch", '--format="%s"', "HEAD")
    body = git("show", "--no-patch", '--format="%b"', "HEAD")

    if not create_release(manifest_path, owner, repo, head_rev, tag_name, summary, body):
        return Status.FAIL

    return Status.SUCCESS
Ejemplo n.º 8
0
def get_sha1():
    """ Get and return sha1 of current git branch HEAD commit."""
    git = get_git_cmd(wpt_root)
    return git("rev-parse", "HEAD").strip()
Ejemplo n.º 9
0
def fetch_wpt(user, *args):
    git = get_git_cmd(wpt_root)
    git("fetch", "https://github.com/%s/debug-ci.git" % user, *args)
Ejemplo n.º 10
0
def fetch_wpt(user, *args):
    git = get_git_cmd(wpt_root)
    git("fetch", "https://github.com/%s/web-platform-tests.git" % user, *args)
Ejemplo n.º 11
0
def get_sha1():
    """ Get and return sha1 of current git branch HEAD commit."""
    git = get_git_cmd(wpt_root)
    return git("rev-parse", "HEAD").strip()
Ejemplo n.º 12
0
def fetch_wpt(user, *args):
    git = get_git_cmd(wpt_root)
    git("fetch", "https://github.com/%s/web-platform-tests.git" % user, *args)