diff --git a/bedevere/backport.py b/bedevere/backport.py index 10c17e8f..5f559432 100644 --- a/bedevere/backport.py +++ b/bedevere/backport.py @@ -84,7 +84,7 @@ async def validate_maintenance_branch_pr(event, gh, *args, **kwargs): pull_request = event.data["pull_request"] base_branch = pull_request["base"]["ref"] - if base_branch == "master": + if base_branch == "main": return title = util.normalize_title(pull_request["title"], diff --git a/bedevere/close_pr.py b/bedevere/close_pr.py index 4827c5fb..b09adc58 100644 --- a/bedevere/close_pr.py +++ b/bedevere/close_pr.py @@ -1,4 +1,4 @@ -"""Automatically close PR that tries to merge maintenance branch into master.""" +"""Automatically close PR that tries to merge maintenance branch into main.""" import re import gidgethub.routing @@ -8,7 +8,7 @@ INVALID_PR_COMMENT = """\ PRs attempting to merge a maintenance branch into the \ -master branch are deemed to be spam and automatically closed. \ +main branch are deemed to be spam and automatically closed. \ If you were attempting to report a bug, please go to bugs.python.org; \ see devguide.python.org for further instruction as needed.""" @@ -21,14 +21,14 @@ async def close_invalid_pr(event, gh, *args, **kwargs): """Close the invalid PR, add 'invalid' label, and post a message. PR is considered invalid if: - * base_label is 'python:master' + * base_label is 'python:main' * head_label is ':' """ head_label = event.data["pull_request"]["head"]["label"] base_label = event.data["pull_request"]["base"]["label"] if PYTHON_MAINT_BRANCH_RE.match(head_label) and \ - base_label == "python:master": + base_label == "python:main": data = {'state': 'closed'} await gh.patch(event.data["pull_request"]["url"], data=data) await gh.post( @@ -46,14 +46,14 @@ async def dismiss_invalid_pr_review_request(event, gh, *args, **kwargs): """Dismiss review request from the invalid PR. PR is considered invalid if: - * base_label is 'python:master' + * base_label is 'python:main' * head_label is ':' """ head_label = event.data["pull_request"]["head"]["label"] base_label = event.data["pull_request"]["base"]["label"] if PYTHON_MAINT_BRANCH_RE.match(head_label) and \ - base_label == "python:master": + base_label == "python:main": data = {"reviewers": [reviewer["login"] for reviewer in event.data["pull_request"]["requested_reviewers"]], "team_reviewers": [team["name"] for team in event.data["pull_request"]["requested_teams"]] } diff --git a/tests/test_backport.py b/tests/test_backport.py index 69f64f34..b20e03a7 100644 --- a/tests/test_backport.py +++ b/tests/test_backport.py @@ -329,7 +329,7 @@ async def test_not_valid_maintenance_branch_pr_title(action): @pytest.mark.parametrize('action', ['opened', 'reopened', 'edited', 'synchronize']) -async def test_maintenance_branch_pr_status_not_posted_on_master(action): +async def test_maintenance_branch_pr_status_not_posted_on_main(action): title = 'Fix some typo' data = { 'action': action, @@ -339,7 +339,7 @@ async def test_maintenance_branch_pr_status_not_posted_on_master(action): 'body': '', 'issue_url': 'https://api.github.com/issue/2248', 'base': { - 'ref': 'master', + 'ref': 'main', }, 'statuses_url': 'https://api.github.com/repos/python/cpython/statuses/somehash', }, diff --git a/tests/test_close_pr.py b/tests/test_close_pr.py index b8778345..842fe3f6 100644 --- a/tests/test_close_pr.py +++ b/tests/test_close_pr.py @@ -45,7 +45,7 @@ async def test_close_invalid_pr_on_open(): "label": "python:3.6" }, "base": { - "label": "python:master" + "label": "python:main" } }, } @@ -80,7 +80,7 @@ async def test_close_invalid_pr_on_synchronize(): "label": "python:3.6" }, "base": { - "label": "python:master" + "label": "python:main" } }, } @@ -115,7 +115,7 @@ async def test_valid_pr_not_closed(): "label": "someuser:bpo-3.6" }, "base": { - "label": "python:master" + "label": "python:main" } }, } @@ -144,7 +144,7 @@ async def test_close_invalid_pr_on_open_not_python_as_head(): "label": "username123:3.6" }, "base": { - "label": "python:master" + "label": "python:main" } }, } @@ -173,7 +173,7 @@ async def test_pr_with_head_branch_containing_all_digits_not_closed(): "label": "someuser:12345" }, "base": { - "label": "python:master" + "label": "python:main" } }, } @@ -203,7 +203,7 @@ async def test_dismiss_review_request_for_invalid_pr(): "label": "python:3.6" }, "base": { - "label": "python:master" + "label": "python:main" }, "requested_reviewers": [ { @@ -246,7 +246,7 @@ async def test_valid_pr_review_request_not_dismissed(): "label": "someuser:bpo-3.6" }, "base": { - "label": "python:master" + "label": "python:main" }, "requested_reviewers": [ {