Skip to content

Run Python Script

Run Python Script #9

Workflow file for this run

name: Run Python Script
on:
push:
branches:
- main
paths:
- main.py # 当 main.py 变动时触发
schedule:
- cron: '0 */6 * * *' # 每隔 6 小时运行一次
workflow_dispatch: # 允许手动触发工作流
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # 更新到 v3
- name: Set up Python
uses: actions/setup-python@v4 # 保持 v4,适用于 Node.js 20
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run script
run: python log/main.py
- name: Upload results
uses: actions/upload-artifact@v4 # 更新到 v4
with:
name: txt-files
path: '*.txt'