Skip to content

Update Pages

Update Pages #40

Workflow file for this run

name: Update Pages
on:
workflow_dispatch:
inputs:
force_update:
description: "Force sync all wiki pages"
required: false
default: false
schedule:
# Every 3 days at 00:00
- cron: "0 0 */3 * *"
jobs:
export:
name: Download wiki pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
branch: main
- name: Clear cache if cache is false
if: ${{ inputs.force_update == 'true' }}
run: |
rm -f last_updated_at.txt
- name: Set timezone to Asia/Shanghai
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- uses: oven-sh/setup-bun@v1
- name: Start export latest wiki pages
env:
API_BASE_URL: https://m.lbkrs.com
API_SECRETS_TOKEN: ${{ secrets.API_SECRETS_TOKEN }}
run: |
bun install
cd scripts/wiki && bun run sync-wikis.ts
- name: Setup Git
run: |
git config --global user.name "LongPort wiki bot"
git config --global user.email "[email protected]"
- name: Create PR for locales/ updates
run: |
BRANCH_NAME=update-pages-$(date +'%Y%m%d%H%M%S')
git checkout -b $BRANCH_NAME
git status
git add .
git commit -m "Commit wiki updated pages to repo"
git push origin $BRANCH_NAME
# Create Pull Request
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"title":"Update wiki pages","head":"'$BRANCH_NAME'","base":"main"}' https://api.github.com/repos/${{ github.repository }}/pulls