From 15ddb464ca16f742d4267e64443707bef62a27c8 Mon Sep 17 00:00:00 2001 From: Yannic Labonte Date: Tue, 2 Apr 2024 05:07:39 +0200 Subject: [PATCH] Rework dependabot auto-merge mechanism/workflow --- .github/dependabot.yml | 7 +++++++ .github/workflows/automerge.yml | 26 ++++++++++---------------- .github/workflows/pylint.yml | 1 + .github/workflows/unittest.yml | 1 + 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 314fece..3f6648e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,12 @@ version: 2 updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + assignees: + - ylabonte + - package-ecosystem: "pip" directory: "/" schedule: diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 21db597..a56eddc 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -3,31 +3,25 @@ name: "Auto-Merge Dependabot PRs" on: pull_request: branches: - - master + - "main" permissions: - actions: read - security-events: write contents: write pull-requests: write jobs: - lint: - name: "Run CI Workflow" - uses: ./.github/workflows/pylint.yml - test: - name: "Run CI Workflow" - uses: ./.github/workflows/unittest.yml automerge: - name: "Auto-merge PR (Dependabot only!)" - needs: - - lint - - test + name: "Auto-approve PR" runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' || github.actor == 'ylabonte' steps: - - name: "Auto-merge the PRs" - run: gh pr merge --auto --merge "$PR_URL" + - name: "Approve PR to enable auto-merge" + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: "Auto-merge PR" + run: gh pr merge --merge --auto "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index b1c77e6..ef7fe6b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -2,6 +2,7 @@ name: Lint on: push: + pull_request: workflow_call: jobs: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 51d54d9..dbb030e 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -2,6 +2,7 @@ name: Unittest on: push: + pull_request: workflow_call: jobs: