forked from pingcap/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Update system-variables.md #50
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
Open
qiancai
wants to merge
27
commits into
master
Choose a base branch
from
test-add-a-variable-15
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9c24ce2
Add files via upload
qiancai 5b0f5a4
Add files via upload
qiancai fb28ac3
Add files via upload
qiancai a38b9ec
Update sync-cloud-zh-toc.yml
qiancai 07ca99b
Add files via upload
qiancai 3721393
Update sync-cloud-zh-toc.yml
qiancai 20e8574
Merge branch 'master' of github.com:qiancai/docs
qiancai 50a5f9a
Merge branch 'master' of github.com:qiancai/docs
qiancai 7a411d4
Merge branch 'master' of github.com:qiancai/docs
qiancai 7dbc37b
Merge branch 'master' of github.com:qiancai/docs
qiancai 2aadfeb
add files
qiancai 4fce98f
Discard changes to system-variables.md
qiancai e68d1c2
Discard changes to ticdc/ticdc-faq.md
qiancai 88d9864
Discard changes to tikv-configuration-file.md
qiancai ab90fca
Merge pull request #43 from qiancai/sync
qiancai e7ed7d1
Update main_workflow.py
qiancai 11efdef
Update sync-docs-cn-to-en.yml
qiancai 322c671
Merge branch 'pingcap:master' into master
qiancai 38c7536
Merge branch 'pingcap:master' into master
qiancai 7e9621c
Merge branch 'upstream-master'
qiancai ebe65dd
Delete scripts/translate_doc_pr directory
qiancai bed0d76
Delete sync-en-cloud-toc-changes-to-zh.py
qiancai c748b45
Merge branch 'master' of github.com:qiancai/docs
qiancai bcea1e9
change the path to the scripts
qiancai 3086f31
Add temp.md
qiancai 05f6804
Delete temp.md
qiancai 3edad37
Auto-sync: Update English docs from Chinese PR https://github.com/qia…
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| name: Sync Docs Changes from ZH PR to EN PR | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| source_pr_url: | ||
| description: 'Source PR URL (Chinese docs repository)' | ||
| required: true | ||
| type: string | ||
| default: '' | ||
| target_pr_url: | ||
| description: 'Target PR URL (English docs repository)' | ||
| required: true | ||
| type: string | ||
| default: '' | ||
| ai_provider: | ||
| description: 'AI Provider to use for translation' | ||
| required: false | ||
| type: choice | ||
| options: | ||
| - deepseek | ||
| - gemini | ||
| default: 'gemini' | ||
|
|
||
| jobs: | ||
| sync-docs: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout current repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Checkout ai-pr-translator repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: "qiancai/ai-pr-translator" | ||
| ref: "main" | ||
| path: "ai-pr-translator" | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.9' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r ai-pr-translator/scripts/requirements.txt | ||
|
|
||
| - name: Extract PR information | ||
| id: extract_info | ||
| run: | | ||
| # Extract source repo info | ||
| SOURCE_URL="${{ github.event.inputs.source_pr_url }}" | ||
| SOURCE_OWNER=$(echo $SOURCE_URL | cut -d'/' -f4) | ||
| SOURCE_REPO=$(echo $SOURCE_URL | cut -d'/' -f5) | ||
| SOURCE_PR=$(echo $SOURCE_URL | cut -d'/' -f7) | ||
|
|
||
| # Extract target repo info | ||
| TARGET_URL="${{ github.event.inputs.target_pr_url }}" | ||
| TARGET_OWNER=$(echo $TARGET_URL | cut -d'/' -f4) | ||
| TARGET_REPO=$(echo $TARGET_URL | cut -d'/' -f5) | ||
| TARGET_PR=$(echo $TARGET_URL | cut -d'/' -f7) | ||
|
|
||
| echo "source_owner=${SOURCE_OWNER}" >> $GITHUB_OUTPUT | ||
| echo "source_repo=${SOURCE_REPO}" >> $GITHUB_OUTPUT | ||
| echo "source_pr=${SOURCE_PR}" >> $GITHUB_OUTPUT | ||
| echo "target_owner=${TARGET_OWNER}" >> $GITHUB_OUTPUT | ||
| echo "target_repo=${TARGET_REPO}" >> $GITHUB_OUTPUT | ||
| echo "target_pr=${TARGET_PR}" >> $GITHUB_OUTPUT | ||
|
|
||
| echo "Source: ${SOURCE_OWNER}/${SOURCE_REPO}#${SOURCE_PR}" | ||
| echo "Target: ${TARGET_OWNER}/${TARGET_REPO}#${TARGET_PR}" | ||
|
|
||
| - name: Get target PR branch info | ||
| id: target_branch | ||
| run: | | ||
| # Get target PR branch name | ||
| TARGET_BRANCH=$(curl -s \ | ||
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| "https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/pulls/${{ steps.extract_info.outputs.target_pr }}" \ | ||
| | jq -r '.head.ref') | ||
|
|
||
| echo "target_branch=${TARGET_BRANCH}" >> $GITHUB_OUTPUT | ||
| echo "Target branch: ${TARGET_BRANCH}" | ||
|
|
||
| - name: Clone target repository | ||
| run: | | ||
| # Clone target repository with the PR branch | ||
| git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}.git target_repo | ||
| cd target_repo | ||
| git checkout ${{ steps.target_branch.outputs.target_branch }} | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Run sync script | ||
| id: sync_script | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| DEEPSEEK_API_TOKEN: ${{ secrets.DEEPSEEK_API_TOKEN }} | ||
| GEMINI_API_TOKEN: ${{ secrets.GEMINI_API_TOKEN }} | ||
| SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }} | ||
| TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }} | ||
| AI_PROVIDER: ${{ github.event.inputs.ai_provider }} | ||
| TARGET_REPO_PATH: ${{ github.workspace }}/target_repo | ||
| run: | | ||
| cd ai-pr-translator/scripts | ||
| if python main_workflow.py; then | ||
| echo "sync_success=true" >> $GITHUB_OUTPUT | ||
| echo "✅ Sync script completed successfully" | ||
| else | ||
| echo "sync_success=false" >> $GITHUB_OUTPUT | ||
| echo "❌ Sync script failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Commit and push changes | ||
| if: steps.sync_script.outputs.sync_success == 'true' | ||
| run: | | ||
| cd target_repo | ||
| git add . | ||
| if git diff --staged --quiet; then | ||
| echo "No changes to commit" | ||
| else | ||
| git commit -m "Auto-sync: Update English docs from Chinese PR ${{ github.event.inputs.source_pr_url }} | ||
|
|
||
| Synced from: ${{ github.event.inputs.source_pr_url }} | ||
| Target PR: ${{ github.event.inputs.target_pr_url }} | ||
| AI Provider: ${{ github.event.inputs.ai_provider }} | ||
|
|
||
| Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | ||
|
|
||
| git push origin ${{ steps.target_branch.outputs.target_branch }} | ||
| echo "Changes pushed to target PR branch: ${{ steps.target_branch.outputs.target_branch }}" | ||
| fi | ||
|
|
||
| - name: Add success comment to target PR | ||
| if: steps.sync_script.outputs.sync_success == 'true' | ||
| run: | | ||
| # Add a comment to the target PR about the sync success | ||
| curl -X POST \ | ||
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| "https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/issues/${{ steps.extract_info.outputs.target_pr }}/comments" \ | ||
| -d "{ | ||
| \"body\": \"🤖 **Auto-sync completed successfully**\\n\\n📥 **Source PR**: ${{ github.event.inputs.source_pr_url }}\\n🎯 **Target PR**: ${{ github.event.inputs.target_pr_url }}\\n✅ English documentation has been updated based on Chinese documentation changes.\\n\\n_This comment was generated automatically by the sync workflow._\" | ||
| }" | ||
|
|
||
| - name: Add failure comment to target PR | ||
| if: steps.sync_script.outputs.sync_success == 'false' | ||
| run: | | ||
| # Add a comment to the target PR about the sync failure | ||
| curl -X POST \ | ||
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| "https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/issues/${{ steps.extract_info.outputs.target_pr }}/comments" \ | ||
| -d "{ | ||
| \"body\": \"🤖 **Auto-sync failed**\\n\\n📥 **Source PR**: ${{ github.event.inputs.source_pr_url }}\\n🎯 **Target PR**: ${{ github.event.inputs.target_pr_url }}\\n❌ The sync process encountered an error. Please check the workflow logs for details.\\n\\n_This comment was generated automatically by the sync workflow._\" | ||
| }" |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve clarity, consider rephrasing this sentence to emphasize the potential negative consequences of modifying this variable. For example: "Modifying this value is strongly discouraged as it can significantly impact query optimization and performance."