-
Notifications
You must be signed in to change notification settings - Fork 82
44 lines (37 loc) · 1.54 KB
/
main.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
name: Auto Extract
on:
push:
branches:
- main
schedule:
- cron: "0 0,12 * * *"
workflow_dispatch:
jobs:
Extract:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run extract script
run: python main.py
- name: Write time into README file
run: |
echo "DATE=$(date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
sed -Ei "s|最近提取于:\`UTC [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\`|最近提取于:\`UTC $(date '+%Y-%m-%d %H:%M:%S')\`|g" README.md
sed -Ei "s|recently extracted at: \`UTC [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\`|recently extracted at: \`UTC $(date '+%Y-%m-%d %H:%M:%S')\`|g" README.md
- name: Commit & Push changes
env:
GITHUB_TOKEN: ${{ github.token }}
uses: stefanzweifel/[email protected]
with:
commit_message: Auto extract by Github Actions at UTC ${{ env.DATE }}
create_branch: true
branch: main
commit_options: '--allow-empty'
push_options: '--force'