Skip to content

Commit

Permalink
tweak(ci): translation cron (#19768)
Browse files Browse the repository at this point in the history
  • Loading branch information
shhdgit authored Jan 17, 2025
1 parent be62462 commit 70abea6
Showing 1 changed file with 45 additions and 14 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
name: cron
name: JA Translation Cron

on:
schedule:
- cron: "0 9 * * 3"
workflow_dispatch:

env:
LTS_BRANCH: i18n-ja-release-8.5
CLOUD_BRANCH: i18n-ja-release-8.1

jobs:
build-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "matrix={\"include\":[{\"name\":\"LTS\",\"value\":\"${{ env.LTS_BRANCH }}\"},{\"name\":\"Cloud\",\"value\":\"${{ env.CLOUD_BRANCH }}\"}]}" >> $GITHUB_OUTPUT

ja:
needs: build-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
continue-on-error: true

steps:
- name: Skip duplicate branch
if: ${{ matrix.name == 'LTS' && env.LTS_BRANCH == env.CLOUD_BRANCH }}
run: |
echo "Skipping duplicate branch ${{ matrix.value }}"
exit 1
- uses: actions/checkout@v4
name: Download translator repo
with:
Expand All @@ -18,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
name: Download docs repo and specified branch
with:
ref: "i18n-ja-release-8.1"
ref: "${{ matrix.value }}"
path: "docs"
- uses: actions/setup-node@v4
name: Setup node 18
Expand Down Expand Up @@ -63,6 +85,15 @@ jobs:
git commit -m "update translated files"
git push
- 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":"${{ matrix.value }}"}}'
# When ja-kernal version is different with cloud, open the comment and run the github action!
# ja-cloud:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -120,16 +151,16 @@ jobs:
# git add .
# git commit -m "update translated files"
# git push
dispatch:
runs-on: ubuntu-latest
needs: [ja]
# dispatch:
# runs-on: ubuntu-latest
# needs: [ja]

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":"i18n-ja-release-8.1"}}'
# 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":"i18n-ja-release-8.1"}}'

0 comments on commit 70abea6

Please sign in to comment.