You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ci: keep GitHub tokens out of process arguments - #24678
The changes in this PR were primarily made by an AI agent on behalf of the PR author.
Do your changes match any of the following descriptions?
Delete files
Change aliases
Need modification after applied to another branch
Might cause conflicts after applied to another branch
Summary by CodeRabbit
Chores
Updated staging automation to use the GitHub CLI while preserving its dispatch targets and inputs. The next-generation dispatch now runs only if the workflow has not been cancelled, and workflow permissions are restricted.
Updated helper scripts to read GitHub credentials from environment variables. They now report an error when no supported credential is configured, rather than reading credentials from a local file.
No actionable comments were generated in the recent review.
Walkthrough
The staging workflow now uses gh api for both dispatches. Two scripts now read GitHub tokens from environment variables instead of a hard-coded token file.
Both scripts read GITHUB_TOKEN first and fall back to GH_TOKEN. They raise RuntimeError if neither variable has a value. Setup comments describe the environment-variable requirement.
The workflow sets permissions: {}. Both dispatches use gh api with environment variables for the token and source details. They retain their respective workflow targets and branches, and send full=false. The next-generation dispatch runs only when the workflow has not been cancelled.
sequenceDiagram
participant DispatchWorkflow
participant GHCLI
participant TargetWorkflow
DispatchWorkflow->>GHCLI: Dispatch workflow with token and source inputs
GHCLI->>TargetWorkflow: Send API dispatch request
Loading
Possibly related PRs
pingcap/docs#24677: Restricts which actors can trigger jobs that use secrets, complementing this change to staging credential handling.
pingcap/docs#24662: Changes credential handling in CI workflows and removes credentials from command arguments.
Suggested reviewers:qiancai, shhdgit
Merge Risk: Minimal · up to 85125
The change keeps GitHub tokens out of process arguments and removes hard-coded token-file reads from two scripts. The nextgen dispatch still runs after a first-dispatch failure. No actionable merge risk remains.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: preventing GitHub tokens from appearing in process arguments.
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The pull request description covers the required change summary, affected TiDB version, related references, AI involvement, and change-type checklists. It also records validation steps. The first-time…
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)
Full details: Description check
Explanation
The pull request description covers the required change summary, affected TiDB version, related references, AI involvement, and change-type checklists. It also records validation steps. The first-time contributor checklist is omitted, which is allowed when not applicable.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 11b7f30 and 851256a.
Files selected for processing: 1
.github/workflows/dispatch.yml
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Approval should wait until the privileged CI authentication and request encoding are validated against the docs-staging workflow inputs in a live staging run.
No open issues 🎉
What changed in this PR
This pull request hardens GitHub credential handling across staging automation and operator scripts by moving tokens out of command-line arguments and plaintext files while preserving existing workflow targets and dispatch inputs.
Changes:
Uses GH_TOKEN with structured gh api requests for both staging workflow dispatches.
Updates both Python scripts to read tokens from GITHUB_TOKEN or GH_TOKEN and report an error when neither is configured.
create_empty_translation_pr.py still uses a literal authorization value in its HTTP requests instead of the loaded token, so authenticated operations require correction.
Replaces plaintext token-file loading with environment-based GitHub credential lookup and validation.
scripts/create_empty_translation_pr.py
Replaces the hardcoded token-file dependency with environment-based credential loading, but its authenticated requests still do not use the loaded token.
.github/workflows/dispatch.yml
Replaces token-bearing curl dispatches with authenticated gh api calls using GH_TOKEN and structured workflow inputs.
Checked the Copilot review note about create_empty_translation_pr.py: the Authorization headers use access_token, which is loaded from GITHUB_TOKEN or GH_TOKEN at startup and passed to the authenticated helper functions. There is no literal or hardcoded token remaining, so no code change is needed for that note.
The actionable dispatch-independence finding is fixed in 851256a.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is changed, added, or deleted? (Required)
GH_TOKENinstead of placing it incurlauthorization argumentsgh apiworkflow-dispatch fields for both staging workflowsGITHUB_TOKENpermissions from the dispatch workflowGITHUB_TOKENorGH_TOKENinstead of hardcoded plaintext filesRelated credential handling in the media upload and Cloud ZH TOC workflows is covered by #24662 and #24677.
Validation:
.github/workflows/dispatch.ymlas YAMLgit diff --checkWhich TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?
Summary by CodeRabbit