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

Test github token before running release script #17562

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog.d/17562.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test github token before running release script steps.
25 changes: 25 additions & 0 deletions scripts-dev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ def tag(gh_token: Optional[str]) -> None:
def _tag(gh_token: Optional[str]) -> None:
"""Tags the release and generates a draft GitHub release"""

if gh_token:
# Test that the GH Token is valid before continuing.
gh = Github(gh_token)
gh.get_user()

# Make sure we're in a git repo.
repo = get_repo_and_check_clean_checkout()

Expand Down Expand Up @@ -418,6 +423,11 @@ def publish(gh_token: str) -> None:
def _publish(gh_token: str) -> None:
"""Publish release on GitHub."""

if gh_token:
# Test that the GH Token is valid before continuing.
gh = Github(gh_token)
gh.get_user()

# Make sure we're in a git repo.
get_repo_and_check_clean_checkout()

Expand Down Expand Up @@ -460,6 +470,11 @@ def upload(gh_token: Optional[str]) -> None:
def _upload(gh_token: Optional[str]) -> None:
"""Upload release to pypi."""

if gh_token:
# Test that the GH Token is valid before continuing.
gh = Github(gh_token)
gh.get_user()

current_version = get_package_version()
tag_name = f"v{current_version}"

Expand Down Expand Up @@ -555,6 +570,11 @@ def wait_for_actions(gh_token: Optional[str]) -> None:


def _wait_for_actions(gh_token: Optional[str]) -> None:
if gh_token:
# Test that the GH Token is valid before continuing.
gh = Github(gh_token)
gh.get_user()

# Find out the version and tag name.
current_version = get_package_version()
tag_name = f"v{current_version}"
Expand Down Expand Up @@ -711,6 +731,11 @@ def _announce() -> None:
@cli.command()
@click.option("--gh-token", envvar=["GH_TOKEN", "GITHUB_TOKEN"], required=True)
def full(gh_token: str) -> None:
if gh_token:
# Test that the GH Token is valid before continuing.
gh = Github(gh_token)
gh.get_user()

click.echo("1. If this is a security release, read the security wiki page.")
click.echo("2. Check for any release blockers before proceeding.")
click.echo(" https://github.com/element-hq/synapse/labels/X-Release-Blocker")
Expand Down
Loading