-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (43 loc) · 1.51 KB
/
wechat.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
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 }}