Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow repo name to be passed from the CLI. #11

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/bot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def print_tree(tree: Tree, parent: Path, depth: int = 0) -> None:
@command()
@option(
"--repo-path",
"--repo",
help="The path to the local git repository.",
type=PathType(
exists=True,
Expand Down Expand Up @@ -59,7 +58,6 @@ def read(
@command()
@option(
"--repo-path",
"--repo",
help="The path to the local git repository.",
type=PathType(
exists=True,
Expand All @@ -69,6 +67,10 @@ def read(
),
required=True,
)
@option(
"--repo-name",
help="The (fully qualified) name of the GitHub repo.",
)
@option(
"--branch",
help="The remote branch on which to add the generated commit.",
Expand Down Expand Up @@ -98,14 +100,15 @@ def write(
app_id: int,
branch: str,
private_key: str,
repo_name: str | None,
repo_path: Path,
ref: str,
) -> None:
"""Read a commit from a local git repo and write it to GitHub."""
basic_config(level=INFO)

repo = read_repo(repo_path)
repo_name = extract_repo_name(repo)
repo_name = repo_name or extract_repo_name(repo)

github = authenticate_app(app_id, private_key)
repository = github.get_repo(repo_name)
Expand Down