59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: Auto Merge
|
|
|
|
on:
|
|
pull_request_target:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
- labeled
|
|
- unlabeled
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
concurrency:
|
|
group: auto-merge-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
enable-auto-merge:
|
|
if: >
|
|
github.event.pull_request.draft == false &&
|
|
github.event.pull_request.base.ref == 'main' &&
|
|
contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
|
(
|
|
github.event.pull_request.head.repo.full_name == github.repository ||
|
|
github.event.pull_request.user.login == 'dependabot[bot]'
|
|
)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Enable GitHub auto-merge
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
run: gh pr merge --auto --squash "$PR_URL"
|
|
|
|
disable-auto-merge:
|
|
if: >
|
|
github.event.action == 'unlabeled' &&
|
|
github.event.label.name == 'dependencies' &&
|
|
github.event.pull_request.base.ref == 'main' &&
|
|
(
|
|
github.event.pull_request.head.repo.full_name == github.repository ||
|
|
github.event.pull_request.user.login == 'dependabot[bot]'
|
|
)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Disable GitHub auto-merge
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
run: gh pr merge --disable-auto "$PR_URL"
|