-
-
Notifications
You must be signed in to change notification settings - Fork 10
48 lines (41 loc) · 2.28 KB
/
dependabot-auto-merge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copied from https://github.com/spatie/package-skeleton-laravel/blob/main/.github/workflows/dependabot-auto-merge.yml
# See https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
name: dependabot-auto-merge
# We're using pull_request_target instead of pull_request due to permission issues with the pull_request target:
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#responding-to-events
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
name: "Dependabot auto-merge"
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: "Dependabot metadata"
# https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#fetch-metadata-about-a-pull-request
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# does not work, see https://github.com/dependabot/fetch-metadata/issues/499
# - name: "Auto-merge Dependabot PRs for semver-minor updates"
# if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
# run: gh pr merge --auto --rebase "$PR_URL"
# env:
# PR_URL: "${{ github.event.pull_request.html_url }}"
# github-token: "${{ secrets.GITHUB_TOKEN }}"
#
# - name: "Auto-merge Dependabot PRs for semver-patch updates"
# if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
# run: gh pr merge --auto --rebase "$PR_URL"
# env:
# PR_URL: "${{ github.event.pull_request.html_url }}"
# github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Enable auto-merge"
if: ${{ steps.metadata.outputs.dependency-type == 'direct:development' }}
run: gh pr merge -R "${{ github.repository }}" --squash --auto "${{ github.event.pull_request.number }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"