Skip to content

Wechat

Wechat #451

Workflow file for this run

name: Wechat
on:
workflow_run:
workflows: ["pages-build-deployment"]
types:
- completed
conclusions:
- success
jobs:
job_name:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check out pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: public # 将 pages 分支检出到名为 'public' 的目录
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Debug
run: git log --oneline -n 2
# 获取最近一次提交中新增加 md 文件,或者从其他目录重命名到 source/_posts 的新文件
- name: Get new files in source/_posts
run: |
set +e
NEW_FILES=$(git diff --name-only --diff-filter=A HEAD^ HEAD | grep 'source/_posts/.*\.md$' || true)
RENAMED_FILES=$(git diff --name-status --find-renames HEAD^ HEAD | awk '/^R/ && !/source\/_posts\/.* -> source\/_posts\// {print $NF}' | grep 'source/_posts/.*\.md$' || true)
MD_FILES="${NEW_FILES}${NEW_FILES:+\n}${RENAMED_FILES}"
echo "MD_FILES=${MD_FILES}" >> $GITHUB_ENV
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run script
run: python wechat_draft.py
env:
APP_ID: ${{ secrets.APP_ID }}
APP_SECRET: ${{ secrets.APP_SECRET }}
PROXY_URL: ${{ secrets.PROXY_URL }}