From d440cfc9e2178ae0ff60060ef2e4cf1f95bb1df0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Thu, 9 Oct 2025 17:15:54 +0100 Subject: [PATCH] Allow any release script command to accept `--gh-token` (#19035) --- changelog.d/19035.misc | 1 + scripts-dev/release.py | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 changelog.d/19035.misc diff --git a/changelog.d/19035.misc b/changelog.d/19035.misc new file mode 100644 index 000000000..a66791904 --- /dev/null +++ b/changelog.d/19035.misc @@ -0,0 +1 @@ +Allow any command of the `release.py` to accept a `--gh-token` argument. \ No newline at end of file diff --git a/scripts-dev/release.py b/scripts-dev/release.py index 73a4e7b7a..a7e967116 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -639,7 +639,16 @@ def _notify(message: str) -> None: @cli.command() -def merge_back() -> None: +# Although this option is not used, allow it anyways. Otherwise the user will +# receive an error when providing it, which is annoying as other commands accept +# it. +@click.option( + "--gh-token", + "_gh_token", + envvar=["GH_TOKEN", "GITHUB_TOKEN"], + required=False, +) +def merge_back(_gh_token: Optional[str]) -> None: _merge_back() @@ -687,7 +696,16 @@ def _merge_back() -> None: @cli.command() -def announce() -> None: +# Although this option is not used, allow it anyways. Otherwise the user will +# receive an error when providing it, which is annoying as other commands accept +# it. +@click.option( + "--gh-token", + "_gh_token", + envvar=["GH_TOKEN", "GITHUB_TOKEN"], + required=False, +) +def announce(_gh_token: Optional[str]) -> None: _announce()