Skip to content

Commit

Permalink
Adds labels to dependency PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
joergi committed Jun 13, 2024
1 parent ba73c6e commit cb163c5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/auto-merge-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Enables auto-merge on dependency pull requests
on:
pull_request:
branches:
- main
workflow_dispatch: {}

jobs:
enable-automerge:
if: |
contains(github.event.pull_request.labels.*.name, 'automerge')
&&
contains(github.event.pull_request.labels.*.name, 'dependencies')
&& (
contains(github.event.pull_request.labels.*.name, 'minor')
|| contains(github.event.pull_request.labels.*.name, 'patch')
)
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4.1.4

- name: find_branch_name
id: find_branch_name
run: |
gh repo view --json nameWithOwner,defaultBranchRef | jq -r '.defaultBranchRef.name'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Find Pull Request
uses: juliangruber/find-pull-request-action@v1
id: find-pull-request
with:
branch: ${{ steps.find_branch_name.outputs.text }}

- name: Auto approve
id: autoApprove
uses: juliangruber/approve-pull-request-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.find-pull-request.outputs.number }}

- name: Enable auto-merge
run: |
gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit cb163c5

Please sign in to comment.