Skip to content

Sync Blog

Sync Blog #720

Workflow file for this run

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"