Beispiel #1
0
def submit_pr(channel, top_level_base, remote_base, local_branch):
    global config

    try:
        milestone_number = get_milestone_for_branch(remote_base)
        if milestone_number is None:
            print('milestone for "' + remote_base + '"" was not found!')
            return 0

        print('(' + channel + ') creating pull request')
        pr_title = config.title or ''
        pr_dst = remote_base
        if is_nightly(channel):
            pr_dst = 'master'

        # add uplift specific details (if needed)
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            pr_body = 'TODO: fill me in\n(created using `npm run pr`)'
        else:
            pr_title += ' (uplift to ' + remote_base + ')'
            pr_body = 'Uplift of #' + str(config.master_pr_number)

        number = create_pull_request(config.github_token,
                                     BRAVE_CORE_REPO,
                                     pr_title,
                                     pr_body,
                                     branch_src=local_branch,
                                     branch_dst=pr_dst,
                                     open_in_browser=True,
                                     verbose=config.is_verbose,
                                     dryrun=config.is_dryrun)

        # store the original PR number so that it can be referenced in uplifts
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            config.master_pr_number = number

        # assign milestone / reviewer(s) / owner(s)
        add_reviewers_to_pull_request(config.github_token,
                                      BRAVE_CORE_REPO,
                                      number,
                                      reviewers=config.reviewers,
                                      verbose=config.is_verbose,
                                      dryrun=config.is_dryrun)
        set_issue_details(config.github_token,
                          BRAVE_CORE_REPO,
                          number,
                          milestone_number,
                          config.parsed_owners,
                          config.labels,
                          verbose=config.is_verbose,
                          dryrun=config.is_dryrun)
    except Exception as e:
        print('[ERROR] unhandled error occurred:', str(e))
Beispiel #2
0
def submit_pr(channel, top_level_base, remote_base, local_branch, issues_fixed):
    global config

    try:
        milestone_number = get_milestone_for_branch(remote_base)
        if milestone_number is None:
            print('milestone for "' + remote_base + '" was not found!')
            return 0

        print('(' + channel + ') creating pull request')
        pr_title = config.title or ''
        pr_dst = remote_base
        if is_nightly(channel):
            pr_dst = 'master'

        # add uplift specific details (if needed)
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            pr_body = 'TODO: fill me in\n(created using `npm run pr`)'
        else:
            pr_title += ' (uplift to ' + remote_base + ')'
            pr_body = 'Uplift of #' + str(config.master_pr_number) + '\n'

            if len(issues_fixed) > 0:
                for fixed in issues_fixed:
                    pr_body += (fixed[0] + '\n')

            pr_body += '\nApproved, please ensure that before merging: \n'
            pr_body += '- [ ] You have checked CI and the builds, lint, and tests all ' \
                       'pass or are not related to your PR. \n'
            pr_body += '- [ ] You have tested your change on Nightly. \n'
            pr_body += '- [ ] The PR milestones match the branch they are landing to. \n\n'
            pr_body += 'After you merge: \n'
            pr_body += '- [ ] The associated issue milestone is set to the smallest version ' \
                       'that the changes is landed on.'

        number = create_pull_request(config.github_token, BRAVE_CORE_REPO, pr_title, pr_body,
                                     branch_src=local_branch, branch_dst=pr_dst,
                                     open_in_browser=True, verbose=config.is_verbose, dryrun=config.is_dryrun)

        # store the original PR number so that it can be referenced in uplifts
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            config.master_pr_number = number

        # assign milestone / reviewer(s) / owner(s)
        add_reviewers_to_pull_request(config.github_token, BRAVE_CORE_REPO, number,
                                      team_reviewers=config.team_reviewers,
                                      verbose=config.is_verbose, dryrun=config.is_dryrun)
        set_issue_details(config.github_token, BRAVE_CORE_REPO, number, milestone_number,
                          config.parsed_owners, config.labels,
                          verbose=config.is_verbose, dryrun=config.is_dryrun)
    except Exception as e:
        print('[ERROR] unhandled error occurred:', str(e))
Beispiel #3
0
def submit_pr(channel, top_level_base, remote_base, local_branch):
    global config

    try:
        milestone_number = get_milestone_for_branch(remote_base)
        if milestone_number is None:
            print('milestone for "' + remote_base + '"" was not found!')
            return 0

        print('(' + channel + ') creating pull request')
        pr_title = config.title or ''
        pr_dst = remote_base
        if is_nightly(channel):
            pr_dst = 'master'

        # add uplift specific details (if needed)
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            pr_body = 'TODO: fill me in\n(created using `npm run pr`)'
        else:
            pr_title += ' (uplift to ' + remote_base + ')'
            pr_body = 'Uplift of #' + str(config.master_pr_number) + '\n\n'
            pr_body += 'Approved, please ensure that before merging: \n'
            pr_body += '- [ ] You have checked CI and the builds, lint, and tests all ' \
                       'pass or are not related to your PR. \n'
            pr_body += '- [ ] You have tested your change on Nightly. \n'
            pr_body += '- [ ] The PR milestones match the branch they are landing to. \n\n'
            pr_body += 'After you merge: \n'
            pr_body += '- [ ] The associated issue milestone is set to the smallest version ' \
                       'that the changes is landed on.'

        number = create_pull_request(config.github_token, BRAVE_CORE_REPO, pr_title, pr_body,
                                     branch_src=local_branch, branch_dst=pr_dst,
                                     open_in_browser=True, verbose=config.is_verbose, dryrun=config.is_dryrun)

        # store the original PR number so that it can be referenced in uplifts
        if is_nightly(channel) or local_branch.startswith(top_level_base):
            config.master_pr_number = number

        # assign milestone / reviewer(s) / owner(s)
        add_reviewers_to_pull_request(config.github_token, BRAVE_CORE_REPO, number,
                                      reviewers=config.reviewers,
                                      verbose=config.is_verbose, dryrun=config.is_dryrun)
        set_issue_details(config.github_token, BRAVE_CORE_REPO, number, milestone_number,
                          config.parsed_owners, config.labels,
                          verbose=config.is_verbose, dryrun=config.is_dryrun)
    except Exception as e:
        print('[ERROR] unhandled error occurred:', str(e))