11# Source: https://nicolasiensen.github.io/2022-07-23-automating-dependency-updates-with-dependabot-github-auto-merge-and-github-actions/
2- name : Dependabot auto-merge
2+ name : PR auto-merge
33on : pull_request_target
44
55permissions :
@@ -16,28 +16,35 @@ jobs:
1616 uses : dependabot/fetch-metadata@v2
1717 with :
1818 github-token : " ${{ secrets.GITHUB_TOKEN }}"
19+
1920 - name : Enable auto-merge for Dependabot PRs
2021 run : gh pr merge --auto --merge "$PR_URL"
2122 env :
2223 PR_URL : ${{github.event.pull_request.html_url}}
2324 GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
25+
2426 - name : Approve patch and minor updates
2527 if : ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
2628 run : gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**"
2729 env :
2830 PR_URL : ${{github.event.pull_request.html_url}}
2931 GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
30- - name : Approve major updates of development dependencies
31- if : ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
32- run : gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a major update of a dependency used only in development**"
32+
33+ - name : Comment on major updates of any dependencies
34+ if : ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major'}}
35+ run : |
36+ gh pr comment $PR_URL --body "I'm **not approving** this PR because **it includes a major update of a dependency**"
37+ gh pr edit $PR_URL --add-label "requires-manual-qa"
3338 env :
3439 PR_URL : ${{github.event.pull_request.html_url}}
3540 GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
36- - name : Comment on major updates of non-development dependencies
37- if : ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
38- run : |
39- gh pr comment $PR_URL --body "I'm **not approving** this PR because **it includes a major update of a dependency used in production**"
40- gh pr edit $PR_URL --add-label "requires-manual-qa"
41+
42+ review-mod-update-pr :
43+ runs-on : ubuntu-latest
44+ if : ${{ github.event.pull_request.title == 'Update Hugo module dependencies' }}
45+ steps :
46+ - name : Enable auto-merge for mod-update PRs
47+ run : gh pr merge --auto --merge "$PR_URL"
4148 env :
4249 PR_URL : ${{github.event.pull_request.html_url}}
4350 GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
0 commit comments