Skip to content

Commit

Permalink
build: automatically merge dependabot PRs on dependencies branch (if …
Browse files Browse the repository at this point in the history
…they pass tests) (#2798)

* build: enable auto-merge for dependabot PRs

* build: create a new dependencies branch each week

* fix: move permissions key to top of auto-approve job

* fix: create dependencies branch on Saturdays

* build: fix spelling of dependencies

* fix: correct spelling of dependencies

* fix: only create new dependencies branch when old one is closed/merged
  • Loading branch information
paulschreiber authored Jan 17, 2025
1 parent 5a6914b commit 427ebf7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: Auto approve

on: pull_request_target

permissions:
pull-requests: write

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.actor == 'dependabot[bot]'
steps:
- uses: hmarr/auto-approve-action@v4
17 changes: 17 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Dependabot auto-merge

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && github.ref == 'refs/heads/dependencies'
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/dependencies-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dependabot auto-merge

on:
pull_request:
branches:
- dependencies
types:
- closed

permissions:
contents: write
pull-requests: write

jobs:
make_branch:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Create dependencies branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "dependencies"

0 comments on commit 427ebf7

Please sign in to comment.