Prefer gh auth over GitHub tokens for Breeze#66255
Conversation
potiuk
left a comment
There was a problem hiding this comment.
Approving in spirit — the design (cleaned-env-first, env-fallback) is the right call, the helpers are small, and CI flows that rely on GITHUB_TOKEN should be unaffected. Left individual comments on items worth fixing before merge:
- Possible dry-run regression in
tigger_workflow(the only behavioral concern; the rest are nits). _get_github_tokentyping/redundancy inrelease_management_commands.py.- Document the "explicit token equals env token" rule (or drop it if Click
envvar=...isn't actually in play for--github-token). - A few missing test cases (
check=Trueraise path,FileNotFoundError, emptygh auth tokenstdout). - Phrasing nit on the workflow-run
GITHUB_TOKENwarning.
Drafted-by: Claude Opus 4.7 (1M context); reviewed by @potiuk before posting
Backport failed to create: v3-2-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 7fef6c1 v3-2-testThis should apply the commit to the v3-2-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
* Breeze: Prefer gh auth over GitHub tokens * Respect dry run functionality * Add Breeze GitHub helper edge-case tests * Clarify Breeze GitHub token precedence * Simplify release management GitHub token resolution * Clarify GITHUB_TOKEN console print
* Breeze: Prefer gh auth over GitHub tokens * Respect dry run functionality * Add Breeze GitHub helper edge-case tests * Clarify Breeze GitHub token precedence * Simplify release management GitHub token resolution * Clarify GITHUB_TOKEN console print (cherry picked from commit 7fef6c1) Co-authored-by: Paul <leeyspaul@users.noreply.github.com>
This PR intentionally focuses on the Breeze auth-resolution paths first, keeping the change small enough to review safely while establishing a reusable helper that can be extended to prek or token-scope validation in follow-up work.
Normalize Breeze GitHub auth resolution so local
GH_TOKEN/GITHUB_TOKENno longer accidentally shadows a validgh auth logincredential.This adds shared helpers for Breeze GitHub auth handling:
run_gh_command(...)for commands that invoke the GitHub CLI directly. It first runsghwithGH_TOKEN/GITHUB_TOKENremoved sogh auth logincan be used, then falls back to the original environment if needed.retrieve_github_token(...)for commands that need a token string. It preserves explicit--github-tokenvalues, otherwise prefers cleanedgh auth token, then falls back toGH_TOKEN/GITHUB_TOKEN.The duplicated local
gh auth tokenfallback logic in Breeze commands is replaced with the shared helper. This updates workflow-run, issue maintenance, CI upgrade, release issue/changelog generation, and provider metadata refresh paths.The main design choice is to treat environment tokens as fallback credentials, not as the preferred local credential. This preserves CI/token-only compatibility while making local Breeze behavior less surprising when a stale or under-scoped
GITHUB_TOKENis present.Tests added for:
GH_TOKEN/GITHUB_TOKENfrom the firstghattemptgh auth tokengh authis unavailableghcommands with the original env only after cleaned-env failureRelated: #55567
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.