From 8687513e8372ce057567f89792441ce056abbfd0 Mon Sep 17 00:00:00 2001 From: ihavecoke Date: Thu, 2 Nov 2023 17:15:35 +0800 Subject: [PATCH] Optimize scripts and action --- .github/workflows/download_feishu_pages.yml | 23 ++++++++++++--------- package.json | 5 ++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/download_feishu_pages.yml b/.github/workflows/download_feishu_pages.yml index d1a9a001..0aa689a2 100644 --- a/.github/workflows/download_feishu_pages.yml +++ b/.github/workflows/download_feishu_pages.yml @@ -12,34 +12,37 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 + - name: Start export feishu pages env: FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }} FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }} - FEISHU_SPACE_ID: '7288219896826494980' + FEISHU_SPACE_ID: "7288219896826494980" OUTPUT_DIR: ./feishu-pages uses: longbridgeapp/feishu-pages@main + - uses: oven-sh/setup-bun@v1 + - name: Copy feishu pages to repo run: | bun install - ./scripts/cp_feishu_to_vitepress.sh - bun autocorrect --fix locales/ - bun translate + bun run setup:vitepress + + - name: Commit feishu pages to repo + run: | git status git add . - git config --global user.name "LongPort Github CI" - git config --global user.email "longportapp-github-ci@users.noreply.github.com" - git commit -a -m "Commit feishu pages to repo" + git config --global user.name "Longbridge Whale docs bot" + git config --global user.email "longbridge-whale-docs@users.noreply.github.com" + git commit -a -m "Commit feishu updated pages to repo" + - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: commit-message: New feishu pages version request review base: dev delete-branch: true - title: '[Docs] New feishu pages version request review' + title: "[Docs] New feishu pages version request review" body: | New feishu pages version request review assignees: ihavecoke - - diff --git a/package.json b/package.json index bb031c52..42783a48 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,16 @@ { "scripts": { + "cp_feishu_pages_to_vitepress": "./scripts/cp_feishu_to_vitepress.sh", "export": "./scripts/export", + "autocort": "bun run autocorrect --fix locales/", "translate": "node ./scripts/hk2cn.js", "build": "vitepress build", "dev": "vitepress dev", "clean:vitepress": "rm -rf .vitepress/dist && rm -rf docs/*", "clean:export": "rm -rf dist/*", "clean": "bun run clean:export && bun run clean:vitepress", - "local:build": "bun run export && bun run translate && bun run build" + "local:build": "bun run export && bun run translate && bun run build", + "setup:vitepress": "bun run cp_feishu_pages_to_vitepress && bun run autocort && bun run translate" }, "dependencies": { "autocorrect-node": "^2.8.4",