Run Python Script #1035
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 | |
schedule: | |
- cron: '*/60 * * * *' # 每小时运行一次 | |
workflow_dispatch: | |
jobs: | |
run-script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: List files in the repository root | |
run: ls -la | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # 使用 Python 3.x 版本 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./requirements.txt # 假设你的脚本需要 requests 库 | |
- name: Run the script | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
run: | | |
echo "Running the script... ${GITHUB_TOKEN}" | |
python github.py "$GITHUB_TOKEN" # 传递环境变量作为命令行参数 |