Skip to content

Run Python script and update image #352

Run Python script and update image

Run Python script and update image #352

Workflow file for this run

name: Run Python script and update image
on:
schedule:
- cron: '0 3 * * *' # 每天凌晨3点运行
push:
branches:
- main # 或者你想要运行这个工作流的分支
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install fonts
run: |
mkdir -p ~/.fonts
cp fonts/* ~/.fonts/
fc-cache -f -v
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests matplotlib pandas mplcyberpunk
- name: Run script
run: |
python ./source/main.py # 替换为你的Python脚本文件名
tree -a
- name: Commit and push if it changed
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git diff --quiet && git diff --staged --quiet || git commit -m "Update image"
git push -f origin main