Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out
<<<<<<< HEAD
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
=======
uses: actions/checkout@v6
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))
- name: Verify duplicated file names
run: ./scripts/verify-duplicated-file-name.sh
- name: Verify internal links and anchors - tidb only
Expand All @@ -32,6 +36,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out
<<<<<<< HEAD
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
Expand All @@ -52,12 +57,58 @@ jobs:
cd ./tmp
./scripts/verify-links.sh
./scripts/verify-link-anchors.sh
=======
uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "18"
cache: npm
cache-dependency-path: package-lock.json
- name: Install Node dependencies
run: npm ci
- name: Verify internal links (full repo) - files
run: ./scripts/verify-links.sh

internal-links-anchors:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "18"
cache: npm
cache-dependency-path: package-lock.json
- name: Install Node dependencies
run: npm ci
- name: Verify internal links (full repo) - anchors
run: ./scripts/verify-link-anchors.sh

internal-links-toc:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "18"
cache: npm
cache-dependency-path: package-lock.json
- name: Install Node dependencies
run: npm ci
- name: Verify internal links (full repo) - TOC membership
run: node ./scripts/verify-internal-links-in-toc.js
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))

vale:
runs-on: ubuntu-latest
steps:
- name: Checkout
<<<<<<< HEAD
uses: actions/checkout@v3
=======
uses: actions/checkout@v6
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))
- name: Vale Linter
uses: errata-ai/vale-action@v2.0.1
with:
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/doc_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: AI Doc Review

on:
workflow_dispatch:

issue_comment:
types:
- created

permissions:
contents: read
pull-requests: write
issues: write

jobs:
review:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '/bot-review') &&
(github.event.comment.user.login == 'hfxsd' || github.event.comment.user.login == 'likidu' || github.event.comment.user.login == 'lilin90' || github.event.comment.user.login == 'Oreoxmt' || github.event.comment.user.login == 'qiancai')
)
steps:
- name: Checkout Repo
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Extract review parameters
id: extract
if: github.event_name == 'issue_comment'
run: |
COMMENT="${{ github.event.comment.body }}"

# Match commit range
if [[ "$COMMENT" =~ \/bot-review:[[:space:]]*([a-f0-9]{7,40})[[:space:]]*\.\.[[:space:]]*([a-f0-9]{7,40}) ]]; then
echo "BASE_SHA=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "HEAD_SHA=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "REVIEW_MODE=commit_range" >> $GITHUB_OUTPUT
printf "Detected commit range with regex: %s..%s\\n" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}"

# Match a single commit
elif [[ "$COMMENT" =~ \/bot-review:[[:space:]]+([a-f0-9]{7,40}) ]]; then
echo "COMMIT_SHA=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "REVIEW_MODE=single_commit" >> $GITHUB_OUTPUT
printf "Detected single commit: %s\\n" "${BASH_REMATCH[1]}"

# Match "/bot-review" or "/bot-review "
elif [[ "$COMMENT" =~ ^\/bot-review[[:space:]]*$ ]]; then
echo "REVIEW_MODE=latest" >> $GITHUB_OUTPUT
echo "Detected default review mode"

# Invalid format
else
echo "REVIEW_MODE=invalid" >> $GITHUB_OUTPUT
echo "Invalid bot-review command format"
fi

echo "Parameters output:"
cat $GITHUB_OUTPUT

- name: AI Doc Reviewer
uses: qiancai/ai-doc-reviewer@main
continue-on-error: false # Ensure workflow fails if the action fails
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_PROVIDER: "openai" # or "openai" if you want to use OpenAI
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_MODEL: "gpt-4o"
exclude: "**/*.json" # Optional: exclude patterns separated by commas
REVIEW_MODE: ${{ steps.extract.outputs.REVIEW_MODE || 'default' }}
COMMIT_SHA: ${{ steps.extract.outputs.COMMIT_SHA || '' }}
BASE_SHA: ${{ steps.extract.outputs.BASE_SHA || '' }}
HEAD_SHA: ${{ steps.extract.outputs.HEAD_SHA || '' }}
PROMPT_PATH: "doc-review-prompt.txt"
97 changes: 97 additions & 0 deletions .github/workflows/ja-full-translation-google.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: JA Full Translation (Google version)

on:
workflow_dispatch:
inputs:
from:
description: "The EN source branch. e.g. release-8.5"
required: true
default: "release-8.5"
to:
description: "The JA target branch. e.g. i18n-ja-release-8.5"
required: true
default: "i18n-ja-release-8.5"

jobs:
ja-translation:
if: github.repository == 'pingcap/docs'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
name: Download translator repo
with:
repository: "pingcap/docs-toolkit"
ref: "main"
path: "docs-toolkit"
- uses: actions/checkout@v6
name: Download specified branch of docs repo
with:
ref: ${{ github.event.inputs.from }}
path: "docs"
- uses: actions/setup-node@v6
name: Setup node
with:
node-version: 20

- run: |
sudo apt install tree -y

- name: Copy doc files to translator folder
run: |
cp -r docs docs-toolkit/markdown-translator/markdowns
rm -rf docs-toolkit/markdown-translator/markdowns/.github
rm -rf docs-toolkit/markdown-translator/markdowns/scripts
rm -rf docs-toolkit/markdown-translator/markdowns/media

- name: Config and translate
run: |
cd docs-toolkit/markdown-translator
echo ${{secrets.GCP_KEY}} | base64 --decode >> key.json
export GOOGLE_APPLICATION_CREDENTIALS=key.json
export PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}
export GLOSSARY_ID=${{ secrets.GCP_GLOSSARY_ID }}
yarn
node src/index_ja.js
cd ..
- name: Copy translated files to docs repo
run: |
cd docs
git checkout -b ${{ github.event.inputs.to }}
cd ..
cp -r docs-toolkit/markdown-translator/output/markdowns/* docs/

- name: Update latest translation commit info
run: |
cd docs
SOURCE_SHA=$(git rev-parse origin/${{ github.event.inputs.from }})
echo '{"target":"${{ github.event.inputs.from }}","sha":"'$SOURCE_SHA'"}' > latest_translation_commit.json

- name: Git commit and push
run: |
cd docs
git config user.name github-actions
git config user.email github-actions@github.com
git add .
if git status | grep -q "Changes to be committed"
then
git commit -m "Update full translated files for JA"
else
echo "No changes detected, skipped"
fi
git push -f --set-upstream origin ${{ github.event.inputs.to }}

dispatch:
if: github.repository == 'pingcap/docs'
runs-on: ubuntu-latest
needs: [ja-translation]

steps:
- name: trigger docs-staging workflow
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.DOCS_STAGING }}" \
https://api.github.com/repos/pingcap/docs-staging/actions/workflows/update.yml/dispatches \
-d '{"ref":"main","inputs":{"full": "false", "repo":"${{ github.repository }}","branch":"${{ github.event.inputs.to }}"}}'
9 changes: 9 additions & 0 deletions .github/workflows/link.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ jobs:
steps:
- uses: actions/checkout@v2

<<<<<<< HEAD
- name: Link Checker
uses: lycheeverse/lychee-action@v1.6.1
=======
- name: Download Exclude Path
run: |
curl -fsSL https://raw.githubusercontent.com/pingcap/docs/master/.lycheeignore --output .lycheeignore

- name: Restore lychee cache
uses: actions/cache@v5
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))
with:
# For parameter description, see https://github.com/lycheeverse/lychee#commandline-parameters
# Accept 429 for now due to github rate limit.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ jobs:
name: Upload media files
runs-on: ubuntu-latest
steps:
<<<<<<< HEAD
- uses: actions/checkout@v3
=======
- uses: actions/checkout@v6
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))
with:
# Must use at least depth 2!
fetch-depth: 2
Expand Down Expand Up @@ -60,10 +64,10 @@ jobs:
TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Python environment
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.12"
architecture: "x64"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prevent-deletion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout base
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch head
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
<<<<<<< HEAD
uses: actions/checkout@v3
=======
uses: actions/checkout@v6
>>>>>>> 0f2e3b14b5 (ci: update actions (#22936))
with:
token: ${{ secrets.REBASE_SECRET_KEY }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
Expand Down
Loading
Loading