Skip to content

Run Python Script

Run Python Script #6

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@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8' # 可以根据需要更改 Python 版本
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run script
run: python main.py
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: txt-files
path: '*.txt'