From ab20a698061e0570b97c9d18db166a50c60434a5 Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Tue, 27 Aug 2024 09:14:33 +0200 Subject: [PATCH] chore: approve and merge automatic PRs --- .github/workflows/automerge_dependabot.yml | 24 +++++++++++++++++++++ .github/workflows/bump.yml | 25 +++++++--------------- 2 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/automerge_dependabot.yml diff --git a/.github/workflows/automerge_dependabot.yml b/.github/workflows/automerge_dependabot.yml new file mode 100644 index 0000000..e0d8f1d --- /dev/null +++ b/.github/workflows/automerge_dependabot.yml @@ -0,0 +1,24 @@ +name: Auto-merge Dependabot +on: pull_request + +permissions: + pull-requests: write + contents: write + +jobs: + automerge: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + + - name: Enable Automerge + if: steps.pull-request.outputs.pull-request-operation == 'created' + run: gh pr merge --merge --auto "${{ github.event.pull_request.number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Approve + if: steps.pull-request.outputs.pull-request-operation == 'created' + run: gh pr review --approve "${{ github.event.pull_request.number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 11b0d8f..0bf23a1 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -91,23 +91,14 @@ jobs: branch: create-pull-request/bump delete-branch: true - - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Enable Pull Request Automerge + - name: Enable Automerge if: steps.pull-request.outputs.pull-request-operation == 'created' - uses: peter-evans/enable-pull-request-automerge@v2 - with: - token: ${{ steps.generate-token.outputs.token }} - pull-request-number: ${{ steps.pull-request.outputs.pull-request-number }} - merge-method: squash + run: gh pr merge --merge --auto "${{ steps.pull-request.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Auto approve + - name: Approve if: steps.pull-request.outputs.pull-request-operation == 'created' - uses: juliangruber/approve-pull-request-action@v1 - with: - github-token: ${{ steps.generate-token.outputs.token }} - number: ${{ steps.pull-request.outputs.pull-request-number }} + run: gh pr review --approve "${{ steps.pull-request.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}