Skip to content

GH-47075: [Release][Dev] Use GH_TOKEN as GitHub token environment variable #47181

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

Merged
merged 7 commits into from
Jul 29, 2025

Conversation

kou
Copy link
Member

@kou kou commented Jul 24, 2025

Rationale for this change

We have many environment variables for GitHub token: GH_TOKEN, ARROW_GITHUB_API_TOKEN and CROSSBOW_GITHUB_TOKEN

It's difficult to maintain. For example, we may forget to define one of them.

What changes are included in this PR?

Use GH_TOKEN as unified environment variable for GitHub token.

We can still use ARROW_GITHUB_API_TOKEN and CROSSBOW_GITHUB_TOKEN for backward compatibility but GH_TOKEN is recommended.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@kou kou marked this pull request as ready for review July 24, 2025 06:11
Copy link

⚠️ GitHub issue #47075 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions bot added awaiting review Awaiting review and removed awaiting review Awaiting review awaiting committer review Awaiting committer review labels Jul 24, 2025
@kou kou force-pushed the gh-token branch 5 times, most recently from da363b6 to 96e0eb1 Compare July 24, 2025 07:30
…nt variable

We can still use `ARROW_GITHUB_API_TOKEN` and `CROSSBOW_GITHUB_TOKEN`
for backward compatibility but `GH_TOKEN` is recommended.
Copy link
Member

@amoeba amoeba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thanks @kou. I left some comments.

Should we update this comment in .env.example too?

diff --git a/dev/release/.env.example b/dev/release/.env.example
index c1e012aacb..43af2851db 100644
--- a/dev/release/.env.example
+++ b/dev/release/.env.example
@@ -31,7 +31,7 @@
 # You must set this.
 #ARTIFACTORY_API_KEY=secret
 
-# The GitHub token to upload artifacts to GitHub Release.
+# The GitHub token used in numerous release scripts.
 #
 # You must set this.
 #GH_TOKEN=secret

@@ -254,10 +255,13 @@ def __init__(self, project_name, cmd):
config = load_configuration()
if "github" in config.sections():
token = config["github"]["api_token"]
if not token:
token = os.environ.get('GH_TOKEN')
if not token:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to warn people they're still using ARROW_GITHUB_API_TOKEN to allow us to fully deprecate it at some point?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added warning message.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 24, 2025
Co-authored-by: Bryce Mecum <petridish@gmail.com>
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Jul 25, 2025
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jul 25, 2025
CROSSBOW_GITHUB_TOKEN is for ursacomputing/crossbow and GH_TOKEN is
for apache/arrow. We may want to use different token for them.
Copy link
Member Author

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I've updated the comment in .env.example.

@@ -254,10 +255,13 @@ def __init__(self, project_name, cmd):
config = load_configuration()
if "github" in config.sections():
token = config["github"]["api_token"]
if not token:
token = os.environ.get('GH_TOKEN')
if not token:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added warning message.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Jul 25, 2025
@kou
Copy link
Member Author

kou commented Jul 29, 2025

I'll merge this.

@kou kou merged commit ea5dad5 into apache:main Jul 29, 2025
10 checks passed
@kou kou removed the awaiting changes Awaiting changes label Jul 29, 2025
@kou kou deleted the gh-token branch July 29, 2025 00:43
@amoeba
Copy link
Member

amoeba commented Jul 29, 2025

Thanks for your work on this @kou.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants