Skip to content

Commit 32632b4

Browse files
committed
feat(workflows): enhance Dependabot PR review process
feat(workflows): enhance Dependabot PR review process 3
1 parent 0e4d299 commit 32632b4

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "daily"
12+
time: "10:50"

.github/workflows/dependabot-reviewer.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,37 @@ jobs:
1010

1111
review-dependabot-pr:
1212
runs-on: ubuntu-latest
13+
14+
# Trigger only if the PR is created by Dependabot
1315
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
16+
17+
env:
18+
PR_URL: ${{ github.event.pull_request.html_url }}
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
1421
steps:
22+
# Fetch metadata from Dependabot
1523
- name: Dependabot metadata
1624
id: dependabot-metadata
1725
uses: dependabot/fetch-metadata@v2.1.0
26+
27+
# Enable auto-merge for Dependabot PRs
1828
- name: Enable auto-merge for Dependabot PRs
1929
run: gh pr merge --auto --merge "$PR_URL"
20-
env:
21-
PR_URL: ${{github.event.pull_request.html_url}}
22-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
30+
31+
# Approve patch and minor updates
2332
- name: Approve patch and minor updates
24-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
25-
run: gh pr review $PR_URL --approve -b "I'm **approving** this pull request because **it includes a patch or minor update**"
26-
env:
27-
PR_URL: ${{github.event.pull_request.html_url}}
28-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor' }}
34+
run: gh pr review $PR_URL --approve -b "I'm **approving** this pull request because it includes a ${{ steps.dependabot-metadata.outputs.update-type }} update"
35+
36+
# Approve major updates of development dependencies
2937
- name: Approve major updates of development dependencies
30-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
38+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development' }}
3139
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-
env:
33-
PR_URL: ${{github.event.pull_request.html_url}}
34-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40+
41+
# Comment on major updates of production dependencies
3542
- name: Comment on major updates of non-development dependencies
36-
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
43+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production' }}
3744
run: |
3845
gh pr comment $PR_URL --body "I'm **not approving** this PR because **it includes a major update of a dependency used in production**"
3946
gh pr edit $PR_URL --add-label "requires-manual-qa"
40-
env:
41-
PR_URL: ${{github.event.pull_request.html_url}}
42-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)