From b2e2361360048b80e9c03a02e1a2f6576fa247d5 Mon Sep 17 00:00:00 2001 From: Martin Bernstorff Date: Wed, 21 Feb 2024 20:27:14 +0100 Subject: [PATCH] ci: automerge with dependabot --- template/.github/dependabot.yml | 15 +++++++++++ .../workflows/dependabot_automerge.yml | 27 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 template/.github/dependabot.yml create mode 100644 template/.github/workflows/dependabot_automerge.yml diff --git a/template/.github/dependabot.yml b/template/.github/dependabot.yml new file mode 100644 index 0000000..9aebe65 --- /dev/null +++ b/template/.github/dependabot.yml @@ -0,0 +1,15 @@ +# Docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + day: "monday" + time: "13:00" + timezone: "Europe/Copenhagen" + open-pull-requests-limit: 20 + commit-message: + prefix: "deps:" + include: "scope" \ No newline at end of file diff --git a/template/.github/workflows/dependabot_automerge.yml b/template/.github/workflows/dependabot_automerge.yml new file mode 100644 index 0000000..34ad4d0 --- /dev/null +++ b/template/.github/workflows/dependabot_automerge.yml @@ -0,0 +1,27 @@ +name: automerge-bot-prs + +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot-automerge: + runs-on: ubuntu-latest + # if actor is dependabot or pre-commit-ci[bot] then run + if: ${{ github.actor == 'dependabot[bot]' }} + + steps: + # Checkout action is required for token to persist + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto approve dependabot PRs + if: ${{ github.actor == 'dependabot[bot]' }} + uses: hmarr/auto-approve-action@v3.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file