diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index ee84784..c8aa809 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -16,8 +16,6 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.user.login == 'dependabot[bot]' steps: - - name: Enable auto-merge for Dependabot PRs - run: gh pr review "$PR_URL" --approve && gh pr merge "$PR_URL" --admin --rebase - env: - PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.YARD_BOT_PAT}} + - uses: ./.github/workflows/dependabot-automerge/action.yml + with: + github-token: ${{secrets.YARD_BOT_PAT}} diff --git a/dependabot-automerge/action.yml b/dependabot-automerge/action.yml new file mode 100644 index 0000000..8a8b7b8 --- /dev/null +++ b/dependabot-automerge/action.yml @@ -0,0 +1,16 @@ +name: Dependabot automerge +description: Automatically approves and merges Dependabot pull requests. +inputs: + github-token: + description: GitHub token with write permissions to the repository. + required: true +runs: + using: "composite" + steps: + - name: Enable auto-merge for Dependabot PRs + if: github.event.pull_request.user.login == 'dependabot[bot]' + shell: bash + run: gh pr review "$PR_URL" --approve && gh pr merge "$PR_URL" --admin --rebase + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{inputs.github-token}} \ No newline at end of file