Skip to content

Sync Docs

Sync Docs #73

Workflow file for this run

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 <infinitydocs.curator@outlook.com>
author: Infinity Curator <infinitydocs.curator@users.noreply.github.com>
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/approve-pull-request-action@v2.0.0
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 }}