@@ -324,6 +324,11 @@ def tag(gh_token: Optional[str]) -> None:
324
324
def _tag (gh_token : Optional [str ]) -> None :
325
325
"""Tags the release and generates a draft GitHub release"""
326
326
327
+ if gh_token :
328
+ # Test that the GH Token is valid before continuing.
329
+ gh = Github (gh_token )
330
+ gh .get_user ()
331
+
327
332
# Make sure we're in a git repo.
328
333
repo = get_repo_and_check_clean_checkout ()
329
334
@@ -418,6 +423,11 @@ def publish(gh_token: str) -> None:
418
423
def _publish (gh_token : str ) -> None :
419
424
"""Publish release on GitHub."""
420
425
426
+ if gh_token :
427
+ # Test that the GH Token is valid before continuing.
428
+ gh = Github (gh_token )
429
+ gh .get_user ()
430
+
421
431
# Make sure we're in a git repo.
422
432
get_repo_and_check_clean_checkout ()
423
433
@@ -460,6 +470,11 @@ def upload(gh_token: Optional[str]) -> None:
460
470
def _upload (gh_token : Optional [str ]) -> None :
461
471
"""Upload release to pypi."""
462
472
473
+ if gh_token :
474
+ # Test that the GH Token is valid before continuing.
475
+ gh = Github (gh_token )
476
+ gh .get_user ()
477
+
463
478
current_version = get_package_version ()
464
479
tag_name = f"v{ current_version } "
465
480
@@ -555,6 +570,11 @@ def wait_for_actions(gh_token: Optional[str]) -> None:
555
570
556
571
557
572
def _wait_for_actions (gh_token : Optional [str ]) -> None :
573
+ if gh_token :
574
+ # Test that the GH Token is valid before continuing.
575
+ gh = Github (gh_token )
576
+ gh .get_user ()
577
+
558
578
# Find out the version and tag name.
559
579
current_version = get_package_version ()
560
580
tag_name = f"v{ current_version } "
@@ -711,6 +731,11 @@ def _announce() -> None:
711
731
@cli .command ()
712
732
@click .option ("--gh-token" , envvar = ["GH_TOKEN" , "GITHUB_TOKEN" ], required = True )
713
733
def full (gh_token : str ) -> None :
734
+ if gh_token :
735
+ # Test that the GH Token is valid before continuing.
736
+ gh = Github (gh_token )
737
+ gh .get_user ()
738
+
714
739
click .echo ("1. If this is a security release, read the security wiki page." )
715
740
click .echo ("2. Check for any release blockers before proceeding." )
716
741
click .echo (" https://github.com/element-hq/synapse/labels/X-Release-Blocker" )
0 commit comments