自动采集 #1891
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 自动采集 | |
# 触发条件 | |
on: | |
workflow_dispatch: | |
# 定时触发 | |
schedule: | |
# 每6小时获取一次 | |
- cron: '0 */12 * * *' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 迁出代码 | |
uses: actions/checkout@v2 | |
- name: 安装Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: 加载缓存 | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/run_in_Actions/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: 设置时区 | |
run: sudo timedatectl set-timezone 'Asia/Shanghai' | |
- name: 安装依赖 | |
run: | | |
pip install -r requirements.txt | |
- name: 执行任务 | |
run: | | |
python main.py | |
- name: 提交更改 | |
run: | | |
git config core.ignorecase false | |
git config --local user.email "[email protected]" | |
git config --local user.name "ermaozi" | |
git add . | |
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')更新订阅链接" | |
git push |