✈️ 固定订阅链接.节点更新 #23
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: ✈️ 固定订阅链接.节点更新 | |
| on: | |
| schedule: | |
| # 每天 (北京时间 6:30) 自动运行 (UTC时间为22:30) | |
| - cron: '30 22/12 * * *' | |
| workflow_dispatch: # 允许手动触发 | |
| push: | |
| branches: | |
| - main | |
| # 注意:[1]这里的路径无法使用变量,如果修改了脚本路径,需要手动同步修改此处 | |
| paths: | |
| - 'TelegramNode/All-in-one_ClashNode.py' | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| env: | |
| # --- 您可以在这里集中修改所有变量 --- | |
| PYTHON_SCRIPT_PATH: TelegramNode/All-in-one_ClashNode.py # <-- 要执行的 Python 脚本路径 | |
| COMMIT_MESSAGE_PREFIX: "✈️ 固定订阅链接.节点更新" # <-- Git 提交信息的前缀 | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| - name: 设置 Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: 安装依赖 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests pyyaml | |
| - name: 运行合并与重命名脚本 | |
| run: | | |
| python ${{ env.PYTHON_SCRIPT_PATH }} | |
| - name: 提交更新到仓库 | |
| run: | | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add flclashyaml/output_yaml | |
| if ! git diff --staged --quiet; then | |
| # 使用 TZ='Asia/Shanghai' 设置时区为北京时间,并调整输出格式 | |
| git commit -m "${{ env.COMMIT_MESSAGE_PREFIX }} $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S') 北京时间" | |
| git push | |
| else | |
| echo "文件无变化,无需提交。" | |
| fi |