Skip to content

Commit 2dd0bee

Browse files
authored
Merge pull request #9 from impresscms-dev/ci/automerge-dependabot-pull-requests
Automerge dependabot pull requests
2 parents 40cdcca + 732864a commit 2dd0bee

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: On pull request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
10+
dependabot:
11+
# needs:
12+
# - test
13+
permissions:
14+
pull-requests: write
15+
contents: write
16+
runs-on: ubuntu-latest
17+
# Checking the actor will prevent your Action run failing on non-Dependabot
18+
# PRs but also ensures that it only does work for Dependabot PRs.
19+
if: ${{ github.actor == 'dependabot[bot]' }}
20+
steps:
21+
# This first step will fail if there's no metadata and so the approval
22+
# will not occur.
23+
- name: Dependabot metadata
24+
id: dependabot-metadata
25+
uses: dependabot/fetch-metadata@v1.3.4
26+
with:
27+
github-token: "${{ secrets.GITHUB_TOKEN }}"
28+
# Here the PR gets approved.
29+
- name: Approve a PR
30+
run: gh pr review --approve "$PR_URL"
31+
env:
32+
PR_URL: ${{ github.event.pull_request.html_url }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
# Finally, this sets the PR to allow auto-merging for patch and minor
35+
# updates if all checks pass
36+
- name: Enable auto-merge for Dependabot PRs
37+
# if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
38+
run: gh pr merge --auto --squash "$PR_URL"
39+
env:
40+
PR_URL: ${{ github.event.pull_request.html_url }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)