- eat 移除 download 依赖库,修复eat2无法响应alias重定向的命令 #70
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: 'Update Config for Main Branch' | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| update-config-on-main: | |
| # 仅在 ClearLuv/TeleBox_Plugins 仓库运行 | |
| # 跳过由机器人自己产生的提交,防止无限循环 | |
| if: | | |
| github.repository == 'ClearLuv/TeleBox_Plugins' && | |
| contains(github.event.head_commit.message, '[ci skip]') == false && | |
| contains(github.event.head_commit.message, 'ci:') == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 步骤 1: 检出(checkout)你的代码 | |
| # 使用默认的 GITHUB_TOKEN,它会自动提供 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} # 使用默认的 GITHUB_TOKEN | |
| # 步骤 2: 修改 eat/config.json 文件 | |
| # 使用 jq 工具,它可以方便地处理 JSON 文件 | |
| - name: 'Update repo_owner and branch in eat/config.json' | |
| run: | | |
| # 定义文件路径 | |
| CONFIG_FILE="eat/config.json" | |
| # 检查文件是否存在 | |
| if [ ! -f "$CONFIG_FILE" ]; then | |
| echo "Error: $CONFIG_FILE not found!" | |
| exit 1 | |
| fi | |
| # 使用 jq 将 .meta.repo_owner 修改为 "TeleBoxDev",并将 .meta.branch 修改为 "main" | |
| # 这个命令会读取原文件,进行两次修改,然后输出到临时文件,最后替换原文件 | |
| jq '.meta.repo_owner = "TeleBoxDev" | .meta.branch = "main"' "$CONFIG_FILE" > temp.json && mv temp.json "$CONFIG_FILE" | |
| echo "$CONFIG_FILE updated successfully." | |
| # 步骤 3: 提交并推送修改 | |
| - name: 'Commit and push changes' | |
| run: | | |
| # 配置 git 用户信息,表明这是由机器人操作的 | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| # 检查是否有文件变动。如果没有变动,则不执行任何操作。 | |
| if git diff --quiet; then | |
| echo "No changes to commit." | |
| exit 0 | |
| fi | |
| # 将修改后的文件添加到暂存区 | |
| git add eat/config.json | |
| # 创建一个新的提交 | |
| git commit -m "ci: Auto-update config for main branch [ci skip]" | |
| # 将提交推送到 main 分支 | |
| git push | |
| echo "Changes have been committed and pushed to the main branch." |