Skip to content

Commit 1fa5902

Browse files
committed
Update all instances of GitHub(gh_token)
1 parent b5c66de commit 1fa5902

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scripts-dev/release.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _publish(gh_token: str) -> None:
429429

430430
if gh_token:
431431
# Test that the GH Token is valid before continuing.
432-
gh = Github(gh_token)
432+
gh = Github(auth=github.Auth.Token(token=gh_token))
433433
gh.get_user()
434434

435435
# Make sure we're in a git repo.
@@ -442,7 +442,7 @@ def _publish(gh_token: str) -> None:
442442
return
443443

444444
# Publish the draft release
445-
gh = Github(gh_token)
445+
gh = Github(auth=github.Auth.Token(token=gh_token))
446446
gh_repo = gh.get_repo("element-hq/synapse")
447447
for release in gh_repo.get_releases():
448448
if release.title == tag_name:
@@ -487,8 +487,13 @@ def _upload(gh_token: Optional[str]) -> None:
487487
click.echo(f"Tag {tag_name} ({tag.commit}) is not currently checked out!")
488488
click.get_current_context().abort()
489489

490+
if gh_token:
491+
gh = Github(auth=github.Auth.Token(token=gh_token))
492+
else:
493+
# Use github anonymously.
494+
gh = Github()
495+
490496
# Query all the assets corresponding to this release.
491-
gh = Github(gh_token)
492497
gh_repo = gh.get_repo("element-hq/synapse")
493498
gh_release = gh_repo.get_release(tag_name)
494499

@@ -759,7 +764,7 @@ def _announce() -> None:
759764
def full(gh_token: str) -> None:
760765
if gh_token:
761766
# Test that the GH Token is valid before continuing.
762-
gh = Github(gh_token)
767+
gh = Github(auth=github.Auth.Token(token=gh_token))
763768
gh.get_user()
764769

765770
click.echo("1. If this is a security release, read the security wiki page.")
@@ -841,7 +846,7 @@ def check_valid_gh_token(gh_token: Optional[str]) -> None:
841846
return
842847

843848
try:
844-
gh = Github(gh_token)
849+
gh = Github(auth=github.Auth.Token(token=gh_token))
845850

846851
# We need to lookup name to trigger a request.
847852
_name = gh.get_user().name

0 commit comments

Comments
 (0)