Auto YouTube VPS Detection #175
This file contains hidden or 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: Auto YouTube VPS Detection | |
| on: | |
| schedule: | |
| - cron: '0 9 * * *' # 每天UTC 9:00运行(调整为您的时区,例如 '0 1 * * *' 为UTC 1:00) | |
| workflow_dispatch: # 允许手动触发(在GitHub Actions页面) | |
| jobs: | |
| detect: | |
| runs-on: ubuntu-latest # 使用最新的Ubuntu虚拟机 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 # 检出仓库代码 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' # 使用Python 3.10(可调整) | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Generate config.json from secrets | |
| env: | |
| YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
| BARK_SERVER_URL: ${{ secrets.BARK_SERVER_URL }} | |
| BARK_KEY: ${{ secrets.BARK_KEY }} | |
| MAX_RESULTS: ${{ secrets.MAX_RESULTS }} | |
| run: | | |
| echo '{ | |
| "youtube_api_key": "'"$YOUTUBE_API_KEY"'", | |
| "bark_server_url": "'"$BARK_SERVER_URL"'", | |
| "bark_key": "'"$BARK_KEY"'", | |
| "max_results": '"$MAX_RESULTS"' | |
| }' > config.json | |
| - name: Run detection script | |
| run: python youtube_vps_detector.py | |
| - name: Clean up config.json (security) | |
| if: always() # 始终运行,即使前一步失败 | |
| run: rm -f config.json # 删除生成的config.json,防止泄露 |