def start_pr_release(repo_full_name, pr_number, pr_title, comment):
    tag = 'pull_request_merger'
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        template_id = GitHubUtils.bootstrapPRMergerTemplate()
    else:
        if len(pr_templates) > 1:
            logger.warn("Found more than one template with tag '%s', using the first one" % tag)
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Merge PR #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('${pull_request_number}', '%s' % pr_number)
    variables.put('${pull_request_title}', '%s' % pr_title)
    variables.put('${repository_full_name}', '%s' % repo_full_name)
    variables.put('${pull_request_comment}', '%s' % comment)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s to merge pull request %s" % (started_release.getId(), pr_number))
Example #2
0
def start_pr_release(repo_full_name, pr_number, pr_title, comment):
    tag = 'pull_request_merger'
    pr_templates = templateApi.getTemplates(tag)
    if not pr_templates:
        template_id = GitHubUtils.bootstrapPRMergerTemplate()
    else:
        if len(pr_templates) > 1:
            logger.warn(
                "Found more than one template with tag '%s', using the first one"
                % tag)
        template_id = pr_templates[0].id

    params = StartRelease()
    params.setReleaseTitle('Merge PR #%s: %s' % (pr_number, pr_title))
    variables = HashMap()
    variables.put('${pull_request_number}', '%s' % pr_number)
    variables.put('${pull_request_title}', '%s' % pr_title)
    variables.put('${repository_full_name}', '%s' % repo_full_name)
    variables.put('${pull_request_comment}', '%s' % comment)
    params.setReleaseVariables(variables)
    started_release = templateApi.start(template_id, params)
    response.entity = started_release
    logger.info("Started release %s to merge pull request %s" %
                (started_release.getId(), pr_number))