Skip to content

Commit

Permalink
Add token name to CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 2, 2025
1 parent 06233ff commit 3710a03
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions potential_closeable_prs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
Issue: TypeAlias = dict[str, Any]


GITHUB_TOKEN = os.environ["GITHUB_TOOLS_TOKEN"]


def check_issue(api: GhApi, issue: Issue) -> list[Issue]:
"""
Look for a chunk like this, collect the PRs:
Expand Down Expand Up @@ -121,8 +118,9 @@ def check_issues(
number: int = 100,
author: str | None = None,
sort_by: str = "newest",
token: str = "GITHUB_TOOLS_TOKEN",
) -> list[Issue]:
api = GhApi(owner="python", repo="cpython", token=GITHUB_TOKEN)
api = GhApi(owner="python", repo="cpython", token=os.environ[token])

sort, direction = sort_by_to_sort_and_direction(sort_by)
candidates = []
Expand Down Expand Up @@ -179,13 +177,18 @@ def main() -> None:
),
help="Sort by",
)
parser.add_argument(
"-t", "--token", default="GITHUB_TOOLS_TOKEN", help="Token environment variable"
)
parser.add_argument(
"-x", "--dry-run", action="store_true", help="show but don't open issues"
)
args = parser.parse_args()

# Find
candidates = check_issues(args.start, args.number, args.author, args.sort)
candidates = check_issues(
args.start, args.number, args.author, args.sort, args.token
)

# Report
print()
Expand Down

0 comments on commit 3710a03

Please sign in to comment.