diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 00000000..cb4fd592 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,34 @@ +name: Manual workflow with Code Sync + +on: + workflow_dispatch: + inputs: + name: + description: 'Person to greet' + default: 'World' + required: true + type: string + +jobs: + greet_and_sync_code: + runs-on: ubuntu-latest + + steps: + - name: Send greeting + run: echo "Hello ${{ inputs.name }}" + + - name: Checkout code + uses: actions/checkout@v2 # 使用 GitHub 提供的官方操作来检出代码库 + + - name: Sync upstream code + run: | + # 同步上游代码 + git remote add upstream https://github.com/songquanpeng/one-api.git + git fetch upstream + git checkout main # 切换到主分支,可以根据实际情况更改分支名 + git merge upstream/main --no-edit # 合并上游主分支的代码,不编辑提交消息 + + # 在这里可以执行其他与同步后的代码相关的任务 + + git push origin main # 将更新后的代码推送到你的仓库 +