Skip to content

Commit d8689a4

Browse files
committed
Dependabot: comment on patch/minor updates
Replace automatic merging of patch/minor Dependabot PRs with an automated comment that guides manual review and merge. Update docs (.github/DEPENDABOT.md) to reflect the new "comment for review" behavior and clarify CI and React/react-dom handling. Change dependabot.yml to rename the production group and add a dedicated react group to keep react and react-dom in sync (preinstall hook compatibility). Update the workflow to post a comment for patch/minor updates instead of running gh pr merge, and restrict the label step to run only for expected semver update types.
1 parent b9eb185 commit d8689a4

3 files changed

Lines changed: 31 additions & 13 deletions

File tree

.github/DEPENDABOT.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ This is the main configuration file that controls Dependabot's behavior:
2424

2525
This workflow automates the merge process for safe dependency updates:
2626

27-
- **Patch updates** (`1.0.0``1.0.1`): Auto-merged
28-
- **Minor updates** (`1.0.0``1.1.0`): Auto-merged
27+
- **Patch updates** (`1.0.0``1.0.1`): Commented for manual merge
28+
- **Minor updates** (`1.0.0``1.1.0`): Commented for manual merge
2929
- **Major updates** (`1.0.0``2.0.0`): Require manual review
3030

3131
## Key Features
@@ -69,9 +69,9 @@ This makes it easier to:
6969

7070
The auto-merge workflow has three behaviors:
7171

72-
**Auto-merge (patch & minor):**
72+
**Comment for review (patch & minor):**
7373
```
74-
✅ Automatically merged after CI passes
74+
💬 Commented with guidance for manual review and merge
7575
```
7676

7777
**Manual review (major):**
@@ -106,8 +106,8 @@ Set to `auto` - Dependabot will automatically rebase PRs when the base branch ch
106106
- These are labeled with `security` by GitHub
107107
- Prioritize reviewing and merging security updates
108108

109-
3. **Keep CI Green**
110-
- Auto-merge only works if CI passes
109+
3. **Keep CI Green (Optional)**
110+
- When CI checks are configured and marked as required, auto-merge only proceeds after they pass
111111
- Ensure your test suite covers critical paths
112112
- Fix failing tests promptly
113113

@@ -129,7 +129,7 @@ Set to `auto` - Dependabot will automatically rebase PRs when the base branch ch
129129
3. **React Version Synchronization**
130130
- This project enforces matching `react` and `react-dom` versions
131131
- The preinstall hook will fail if versions don't match
132-
- Dependabot is configured to handle this automatically
132+
- Dependabot's `react` group configuration (see `.github/dependabot.yml`) ensures these packages are always updated together
133133

134134
## Troubleshooting
135135

.github/dependabot.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@ updates:
2424
- "minor"
2525
- "patch"
2626

27-
# Group production dependencies by update type
28-
production-dependencies-minor:
27+
# Group production dependencies (patch & minor updates)
28+
production-dependencies:
2929
dependency-type: "production"
3030
update-types:
3131
- "minor"
3232
- "patch"
3333

34+
# Ensure react and react-dom are always updated together
35+
# This prevents version mismatch issues with the preinstall hook
36+
react:
37+
patterns:
38+
- "react"
39+
- "react-dom"
40+
3441
# Keep major updates separate for careful review
3542
# (Major updates are not grouped and will create individual PRs)
3643

.github/workflows/dependabot-auto-merge.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,19 @@ jobs:
2222
with:
2323
github-token: "${{ secrets.GITHUB_TOKEN }}"
2424

25-
- name: Enable auto-merge for patch and minor updates
26-
# Auto-merge patch and minor version updates (safer updates)
27-
# Major updates require manual review due to potential breaking changes
25+
- name: Comment on patch and minor updates
26+
# For patch and minor version updates, add a comment to guide manual review and merge
27+
# This avoids unsafe auto-merging when no CI checks are configured on pull requests
2828
if: |
2929
steps.metadata.outputs.update-type == 'version-update:semver-patch' ||
3030
steps.metadata.outputs.update-type == 'version-update:semver-minor'
31-
run: gh pr merge --auto --squash "$PR_URL"
31+
run: |
32+
gh pr comment "$PR_URL" --body "✅ **Dependabot patch/minor update detected**
33+
34+
This PR updates dependencies with a patch or minor version change.
35+
36+
Please ensure that all relevant CI checks (if configured) have passed and that the
37+
application still builds and runs as expected before merging this PR manually."
3238
env:
3339
PR_URL: ${{ github.event.pull_request.html_url }}
3440
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -49,6 +55,11 @@ jobs:
4955

5056
- name: Label Dependabot PRs
5157
# Add helpful labels based on update type
58+
# Only runs when UPDATE_TYPE matches one of the expected semver types
59+
if: |
60+
steps.metadata.outputs.update-type == 'version-update:semver-major' ||
61+
steps.metadata.outputs.update-type == 'version-update:semver-minor' ||
62+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
5263
run: |
5364
if [[ "$UPDATE_TYPE" == "version-update:semver-major" ]]; then
5465
gh pr edit "$PR_URL" --add-label "major-update"

0 commit comments

Comments
 (0)