-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.27 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Update Pages
on:
workflow_dispatch:
inputs:
cache:
description: "if use feishu-pages cache"
required: false
default: true
schedule:
# Every 3 days at 00:00
- cron: "0 0 */3 * *"
jobs:
export:
name: Download feishu pages
timeout-minutes: 180
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
branch: main
- name: Clear cache if cache is false
if: ${{ inputs.cache == 'false' }}
run: |
rm -rf ./feishu-pages/.cache/blocks
- name: Start export feishu pages
env:
FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }}
FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }}
FEISHU_SPACE_ID: "7288219896826494980"
OUTPUT_DIR: ./feishu-pages
URL_STYLE: original
BASE_URL: ./
uses: longbridgeapp/feishu-pages@main
- uses: oven-sh/setup-bun@v1
- name: Copy Pages to repo
run: |
bun install
bun run setup
- name: Setup Git
run: |
git config --global user.name "Longbridge Whale docs 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 locales/
git add feishu-pages/docs.json
git add feishu-pages/docs-zh-cn.json
git commit -m "Commit feishu updated pages to repo"
git push origin $BRANCH_NAME
# Create Pull Request
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"title":"Update feishu pages","head":"'$BRANCH_NAME'","base":"main"}' https://api.github.com/repos/${{ github.repository }}/pulls
- name: Push feishu-pages/.cache to main branch
run: |
git checkout main
git add feishu-pages/.cache
git config --global user.name "Longbridge Whale docs bot"
git config --global user.email "[email protected]"
git commit -m "Update feishu-pages/.cache" || echo "No changes to commit"
git push origin main