From 43adeee72cffdf2e50884910143622e6c184cc12 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Thu, 17 Jul 2025 16:53:23 +0200 Subject: [PATCH] [v3-0-test] Make GITHUB_TOKEN variable mandatory when updating installers (#53452) When running "update-installers-and-pre-commit" pre-commit, the script is virtually guaranteed to fail with "rate limits" reached if you do not use GITHUB_TOKEN. This change makes GITHUB_TOKEN variable mandatory for the pre-commit, it prints the helpful information and prints URL that allows to create such GITHUB_TOKEN very easily. (cherry picked from commit aeb0d4cafa11ddc0d29bd7c64117195f8ac3768e) Co-authored-by: Jarek Potiuk --- .../ci/pre_commit/update_installers_and_pre_commit.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/ci/pre_commit/update_installers_and_pre_commit.py b/scripts/ci/pre_commit/update_installers_and_pre_commit.py index eed555e93fe40..70054b6d5508c 100755 --- a/scripts/ci/pre_commit/update_installers_and_pre_commit.py +++ b/scripts/ci/pre_commit/update_installers_and_pre_commit.py @@ -249,6 +249,16 @@ def replacer(match): if __name__ == "__main__": + if not GITHUB_TOKEN: + console.print( + "[red]GITHUB_TOKEN environment variable is not set. This will lead to failures on rate limits.[/]\n" + "Please set it to a valid GitHub token with public_repo scope. You can create one by clicking " + "the URL:\n\n" + "https://github.com/settings/tokens/new?scopes=public_repo&description=airflow-update-installers-and-pre-commit\n\n" + "Once you have the token you can prepend pre-commit command with GITHUB_TOKEN='' or" + "set it in your environment with export GITHUB_TOKEN=''\n\n" + ) + sys.exit(1) changed = False golang_version = get_latest_golang_version() pip_version = get_latest_pypi_version("pip")