Skip to content

Commit

Permalink
Support creating draft PRs for Github Pull Requests
Browse files Browse the repository at this point in the history
  • Loading branch information
clickthisnick2 committed Nov 7, 2024
1 parent 15fb8f0 commit 8d66c03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions all_repos/push/github_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Settings(NamedTuple):
base_url: str = 'https://api.github.com'
api_key: str | None = None
api_key_env: str | None = None
draft: bool = False

# TODO: https://github.com/python/mypy/issues/8543
def __repr__(self) -> str:
Expand Down Expand Up @@ -56,6 +57,7 @@ def make_pull_request(
'body': body.decode().strip(),
'base': autofix_lib.target_branch(),
'head': head,
'draft': settings.draft,
}).encode()

return github_api.req(
Expand Down
2 changes: 2 additions & 0 deletions tests/push/github_pull_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_github_pull_request(mock_urlopen, fake_github_repo):
assert data['title'] == 'This is a commit message'
assert data['body'] == 'Here is some more information!'
assert data['head'] == 'feature'
assert data['draft'] is False


@pytest.fixture
Expand Down Expand Up @@ -96,5 +97,6 @@ def test_settings_repr():
" base_url='https://api.github.com',\n"
' api_key=...,\n'
' api_key_env=None,\n'
' draft=False,\n'
')'
)
1 change: 1 addition & 0 deletions tests/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_hide_api_key_repr():
" base_url='https://api.github.com',\n"
' api_key=...,\n'
' api_key_env=None,\n'
' draft=False,\n'
')'
)

Expand Down

0 comments on commit 8d66c03

Please sign in to comment.