Skip to content

new Issue 149 - Automated PR #64

new Issue 149 - Automated PR

new Issue 149 - Automated PR #64

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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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@48b6133aa6c826f267ebd33aa2d29470f9d9e7d0 # v1
id: find-pull-request
with:
branch: ${{ steps.find_branch_name.outputs.text }}
- name: Auto approve
id: autoApprove
uses: juliangruber/approve-pull-request-action@b71c44ff142895ba07fad34389f1938a4e8ee7b0 # 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}}