-
Notifications
You must be signed in to change notification settings - Fork 66
55 lines (50 loc) · 1.52 KB
/
sync_blog.yaml
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
name: Sync Blog
on:
schedule:
- cron: "30 4 * * *"
- cron: "0 11 * * *"
workflow_dispatch:
jobs:
sync_blog:
runs-on: ubuntu-latest
if: github.repository == 'emqx/blog'
steps:
- name: Set git
run: |
git config --global user.name "emqx-ci-robot"
git config --global user.email "[email protected]"
- name: Checkout code
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Sync blogs
id: sync_blog
run: |
set -x
branch=$(date +%Y-%m-%d-%H-%M-%S)
echo "branch=$branch" >> $GITHUB_OUTPUT
git checkout -b $branch
rm -rf en/*
rm -rf zh/*
rm -rf ja/*
python3 .ci/sync_blog.py $(pwd)
python3 .ci/generate_readme.py $(pwd)
git status
if [ -z "$(git status --short)" ]; then
echo "No changes to push"
echo "changed=0" >> $GITHUB_OUTPUT
else
git add .
git commit -m "sync blog"
git push origin $branch
echo "changed=1" >> $GITHUB_OUTPUT
fi
- name: Pull request
uses: repo-sync/pull-request@v2
if: steps.sync_blog.outputs.changed == 1
with:
source_branch: ${{ steps.sync_blog.outputs.branch }}
destination_branch: main
github_token: ${{ secrets.GROWTH_CI_TOKEN }}
pr_title: "sync blogs ${{ steps.sync_blog.outputs.branch }}"
pr_reviewer: "CrazyWisdom,Red-Asuka,Swilder-M"