Skip to content

Conversation

@alastori
Copy link
Collaborator

@alastori alastori commented Jan 20, 2026

What is changed, added or deleted? (Required)

Add repository checks (if: github.repository == 'pingcap/docs') to workflows that use secrets, preventing failures when contributors fork the repository.

Why

When users fork pingcap/docs, workflows requiring secrets fail because GitHub does not expose repository secrets to forks (a security feature). This causes:

  • Confusing red X marks on fork commits
  • Noisy workflow failure notifications
  • Unnecessary compute cycles on skipped-but-failed jobs

Changes

Added if: github.repository == 'pingcap/docs' condition to jobs in:

Workflow Secret(s) Used
dispatch.yml DOCS_STAGING
rebase.yml REBASE_SECRET_KEY
ja-full-translation-google.yaml GCP_KEY, GCP_PROJECT_ID, GCP_GLOSSARY_ID, DOCS_STAGING
translation-cron.yml GCP_KEY, GCP_PROJECT_ID, GCP_GLOSSARY_ID, DOCS_STAGING
translation-zh.yaml LANGLINK_ACCESS_KEY, LANGLINK_ACCESS_SECRET, LANGLINK_USER
translation-zh-switch.yaml LANGLINK_ACCESS_KEY, LANGLINK_ACCESS_SECRET, LANGLINK_USER
sync-cloud-zh-toc.yml GEMINI_API_TOKEN
sync-doc-pr-zh-to-en.yml DEEPSEEK_API_TOKEN, GEMINI_API_TOKEN
media.yml QINIU_ACCESS_KEY, QINIU_SECRET_KEY, QINIU_BUCKET_NAME
bot.yaml Repository-specific scheduled job
link.yaml Repository-specific scheduled job

Pattern

This is a standard GitHub Actions pattern for handling fork workflows:

Already used in this repository:

Used by major open-source projects:

Validation

Tested on fork (alastori/tidb-docs):

Workflow Trigger Result
translation-zh.yaml workflow_dispatch ✅ Job skipped (guard working)
bot.yaml workflow_dispatch ✅ Job skipped (guard working)
link.yaml workflow_dispatch ✅ Job skipped (guard working)
ci.yaml pull_request ✅ Runs normally (no guard needed)
link-fail-fast.yaml pull_request ✅ Runs normally (no guard needed)

Which TiDB version(s) do your changes apply to? (Required)

  • master (CI/infrastructure change, not version-specific)

What is the related PR or file link(s)?

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

@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@ti-chi-bot ti-chi-bot bot added the missing-translation-status This PR does not have translation status info. label Jan 20, 2026
@pingcap-cla-assistant
Copy link

pingcap-cla-assistant bot commented Jan 20, 2026

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 20, 2026
Add conditional checks to ensure workflows that require secrets
only run on the main pingcap/docs repository. This prevents
workflow failures on forks where secrets are unavailable.

Affected workflows:
- dispatch.yml (DOCS_STAGING)
- rebase.yml (REBASE_SECRET_KEY)
- ja-full-translation-google.yaml (GCP credentials, DOCS_STAGING)
- translation-cron.yml (GCP credentials, DOCS_STAGING)
- translation-zh.yaml (LANGLINK credentials)
- translation-zh-switch.yaml (LANGLINK credentials)
- sync-cloud-zh-toc.yml (GEMINI_API_TOKEN)
- sync-doc-pr-zh-to-en.yml (DEEPSEEK_API_TOKEN, GEMINI_API_TOKEN)
- media.yml (QINIU credentials)
- bot.yaml (repository-specific)
- link.yaml (repository-specific)
@alastori alastori force-pushed the claude/investigate-gh-actions-fork-errors-rLbn8 branch from 2f884bf to ccf386c Compare January 20, 2026 00:38
@alastori
Copy link
Collaborator Author

Hi @shhdgit @qiancai @Oreoxmt - this PR adds repository guards to workflows that use secrets, following the same pattern already used in media.yml, bot.yaml, and link.yaml. Would appreciate a review when you have a chance. Thanks!

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 20, 2026
Accepting your suggestion to remove the guard. Since it's workflow_dispatch only, contributors won't accidentally trigger it - they'd need to intentionally run it and configure their own API keys (DEEPSEEK_API_TOKEN, GEMINI_API_TOKEN).

Co-authored-by: Grace Cai <[email protected]>
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 21, 2026
@qiancai
Copy link
Collaborator

qiancai commented Jan 21, 2026

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 21, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-01-20 02:54:05.063164832 +0000 UTC m=+462472.677121698: ☑️ agreed by Oreoxmt.
  • 2026-01-21 01:15:40.37077833 +0000 UTC m=+542967.984735187: ☑️ agreed by qiancai.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Jan 21, 2026
@qiancai qiancai self-assigned this Jan 21, 2026
@qiancai qiancai added translation/doing This PR's assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. approved labels Jan 21, 2026
@ti-chi-bot ti-chi-bot bot added the approved label Jan 21, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 21, 2026

@qiancai: You cannot manually add or delete the cherry pick approval state labels, only I and the tursted members have permission to do so. You can approve it in internal platform.

Details

In response to removing label named approved.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot merged commit 8c19871 into pingcap:master Jan 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files. translation/doing This PR's assignee is translating this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants