Skip to content

Commit

Permalink
Rework dependabot auto-merge mechanism/workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ylabonte committed Apr 2, 2024
1 parent 15e206a commit 15ddb46
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
assignees:
- ylabonte

- package-ecosystem: "pip"
directory: "/"
schedule:
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
1 change: 1 addition & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lint

on:
push:
pull_request:
workflow_call:

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Unittest

on:
push:
pull_request:
workflow_call:

jobs:
Expand Down

0 comments on commit 15ddb46

Please sign in to comment.