-
Notifications
You must be signed in to change notification settings - Fork 10
84 lines (73 loc) · 2.91 KB
/
sync_docs.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
73
74
75
76
77
78
79
80
81
82
83
84
name: Sync Docs
on:
schedule:
- cron: '0 */8 * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout the RAGFlow repository
# https://github.com/actions/checkout/blob/v3/README.md
uses: actions/checkout@v3
with:
repository: infiniflow/ragflow
# Relative path under $GITHUB_WORKSPACE to place the repository
path: source
- name: Checkout RAGFlow docs repo
uses: actions/checkout@v3
with:
repository: infiniflow/ragflow-docs
path: target
- name: Install Dependences
# Install lightweight command-line JSON processor
run: sudo apt-get install -y jq
- name: Set Env
run: |
echo "RAGFLOW_MAIN=${GITHUB_WORKSPACE}/source" >> $GITHUB_ENV
echo "RAGFLOW_WEBSITE=${GITHUB_WORKSPACE}/target" >> $GITHUB_ENV
- name: Export Env
run: |
export RAGFLOW_MAIN=${{ env.RAGFLOW_MAIN }}
export RAGFLOW_WEBSITE=${{ env.RAGFLOW_WEBSITE }}
- name: Sync and stage changes
run: |
cd $RAGFLOW_MAIN && git fetch --tags
cd $RAGFLOW_WEBSITE/website && ./sync_docs.sh
- name: Create a Pull Request
id: create-pr
# https://github.com/peter-evans/create-pull-request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.FLOW_PAT }}
path: target
commit-message: Synchronize documentation.
committer: Infinity Curator <[email protected]>
author: Infinity Curator <[email protected]>
signoff: false
base: main
branch: sync-documentation
delete-branch: true
draft: false
title: '[Cron] Sync and update documentation'
body: 'Auto-generated and will be automatically merged.'
labels: |
automation
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
echo "Pull Request Operation - ${{ steps.create-pr.outputs.pull-request-operation }}"
- name: Enable auto-merge on the pull request
if: steps.create-pr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.FLOW_PAT }}
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }}
merge-method: squash
- name: Auto approve the pull request
if: steps.create-pr.outputs.pull-request-operation == 'created'
uses: juliangruber/[email protected]
with:
# Use Action Bot to approve the pull request because one cannot approve his own.
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create-pr.outputs.pull-request-number }}