Skip to content

Commit cea37bf

Browse files
authored
fix(ci): run lockfile fixer for reopened dependabot prs
* fix(ci): run lockfile fixer for reopened dependabot prs * ci(dependabot): auto-merge safe npm updates * docs(release): clarify branch migration and defaults
1 parent c120da0 commit cea37bf

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Dependabot Auto Merge
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- ready_for_review
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
concurrency:
16+
group: dependabot-auto-merge-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
enable-auto-merge:
21+
if: >
22+
github.event.pull_request.user.login == 'dependabot[bot]' &&
23+
github.event.pull_request.head.repo.full_name == github.repository &&
24+
!github.event.pull_request.draft
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Fetch Dependabot metadata
29+
id: metadata
30+
uses: dependabot/fetch-metadata@v2
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Enable auto-merge for safe npm updates
35+
if: >
36+
steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' &&
37+
steps.metadata.outputs.update-type == 'version-update:semver-patch'
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
PR_URL: ${{ github.event.pull_request.html_url }}
41+
run: gh pr merge --auto --merge "$PR_URL"

.github/workflows/dependabot-lockfile-fixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919
jobs:
2020
fix-lockfiles:
2121
if: >
22-
github.actor == 'dependabot[bot]' &&
22+
github.event.pull_request.user.login == 'dependabot[bot]' &&
2323
github.event.pull_request.head.repo.full_name == github.repository
2424
runs-on: ubuntu-latest
2525

readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ For this repository itself, stable releases come from `main` and prereleases com
9595

9696
## Usage
9797

98+
<p>
99+
<strong style="color:#b91c1c;">Migration notice:</strong>
100+
this preset does not hardcode consumer release branches. `main` is the documented default, but if your repository still releases from `master` or another branch, set `branches` explicitly in your repo-local semantic-release config.
101+
</p>
102+
98103
Example `.releaserc.yaml`:
99104

100105
```yaml
@@ -108,6 +113,17 @@ debug: false
108113
109114
If your repository releases from a different branch, set `branches` explicitly in your repo-local config.
110115

116+
Example migration from `master`:
117+
118+
```yaml
119+
branches:
120+
- master
121+
extends: "semantic-release-npm-github-publish"
122+
ci: false
123+
dryRun: false
124+
debug: false
125+
```
126+
111127
## When To Use This Preset
112128

113129
Use this package when you want:
@@ -124,7 +140,9 @@ Use repo-local plugin composition instead when your team wants different plugins
124140
- Consumer-facing examples now use `main`.
125141
- Repository automation publishes stable releases from `main` and prereleases from `beta`.
126142
- The repository default branch is `main`, and all badges and examples now follow that.
143+
- The shared preset does not hardcode release branches for consumers; set `branches` in your repo-local config when you do not release from `main`.
127144
- Dependabot PRs can auto-refresh `package-lock.json` through the dedicated lockfile-fixer workflow.
145+
- Dependabot npm patch updates can enable GitHub auto-merge after required checks pass.
128146
- The old README wording that inverted `fix` and `feat` was documentation drift. The actual release behavior has been corrected and is now covered by tests.
129147

130148
## Contributing

0 commit comments

Comments
 (0)