Skip to content

Prek: Prefer gh auth over GitHub token env#66692

Merged
potiuk merged 1 commit into
apache:mainfrom
leeyspaul:prek-gh-auth-resolution
May 11, 2026
Merged

Prek: Prefer gh auth over GitHub token env#66692
potiuk merged 1 commit into
apache:mainfrom
leeyspaul:prek-gh-auth-resolution

Conversation

@leeyspaul
Copy link
Copy Markdown
Contributor

@leeyspaul leeyspaul commented May 11, 2026

GH_TOKEN / GITHUB_TOKEN no longer shadow a valid gh auth login credential when prek helpers resolve a GitHub token.

This applies the same GitHub auth precedence used by Breeze to local prek scripts: explicit token arguments still win, then helpers try gh auth token with token env vars removed, then they fall back to ambient token env vars for CI/token-only environments.

Updated paths:

  • upgrade_important_versions.py via retrieve_gh_token(...)
  • download_k8s_schemas.py via optional token resolution, preserving unauthenticated fallback

Tests cover explicit-token precedence, cleaned gh auth token precedence, env fallback, missing gh, blank gh auth token output, and the existing fatal help path when a required token cannot be resolved.

I kept these as small scripts/ci/prek helpers instead of importing the Breeze helper because the two paths run in different package/runtime contexts.

Breeze owns airflow_breeze.utils.github, while these are Airflow-owned local prek scripts that can run as standalone hook/script entries. Making prek helpers importairflow_breeze would couple local hook execution to Breeze being importable in that environment. The logic is intentionally duplicated here, but kept minimal: token resolution only, not the broader Breeze gh command wrapper.

Breeze PR: #66255

Related: #55567


Was generative AI tooling used to co-author this PR?
  • Yes - GPT-5.5

Generated-by: GPT-5.5 following the guidelines

@boring-cyborg boring-cyborg Bot added area:dev-tools backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch labels May 11, 2026
@potiuk potiuk marked this pull request as ready for review May 11, 2026 22:29
@potiuk potiuk merged commit 502c8b9 into apache:main May 11, 2026
143 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented May 11, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@github-actions
Copy link
Copy Markdown
Contributor

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

potiuk added a commit that referenced this pull request May 12, 2026
(cherry picked from commit 502c8b9)

Co-authored-by: Paul <leeyspaul@gmail.com>
Co-authored-by: paullee <leeyspaul@users.noreply.github.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants