Update main.py #19
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: Run Python Script | |
on: | |
push: | |
branches: | |
- main # 在 main 分支上推送时触发 | |
workflow_dispatch: # 可以手动触发 | |
jobs: | |
run-script: | |
runs-on: ubuntu-latest # 使用最新的 Ubuntu 作为运行环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' # 设置 Python 版本 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests beautifulsoup4 PyGithub | |
- name: Run main.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 从 GitHub Secrets 获取 Token | |
run: python main.py |