From 9825d89ab9abc6dd1e3f94f7b15adbe1bb00eda0 Mon Sep 17 00:00:00 2001 From: sheepgreen <58287293+slippersheepig@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:17:54 +0800 Subject: [PATCH] Create auto-merge-dependabot.yml --- .github/workflows/auto-merge-dependabot.yml | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/auto-merge-dependabot.yml diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml new file mode 100644 index 0000000..a9545ca --- /dev/null +++ b/.github/workflows/auto-merge-dependabot.yml @@ -0,0 +1,34 @@ +name: Auto Merge Dependabot PRs + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + merge: + if: github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install gh + run: | + wget https://github.com/cli/cli/releases/download/v2.0.0/gh_2.0.0_linux_amd64.tar.gz + tar -xvf gh_2.0.0_linux_amd64.tar.gz + sudo mv gh_2.0.0_linux_amd64/bin/gh /usr/local/bin + + - name: Configure Git + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + - name: Merge PR + run: | + # 获取 PR 号码 + PR_NUMBER=$(jq -r .pull_request.number < "$GITHUB_EVENT_PATH") + # 合并 PR + gh pr merge $PR_NUMBER --auto --merge --delete-branch