1717 node-version :
1818 - 18.x
1919 - 20.x
20+ - 22.x
2021 steps :
2122 - uses : actions/checkout@v5
2223 - name : Use Node.js ${{ matrix.node-version }}
@@ -28,14 +29,27 @@ jobs:
2829 - run : npm test
2930 - run : npm run build --if-present
3031 - name : Save build
31- if : matrix.node-version == '18 .x'
32+ if : matrix.node-version == '20 .x'
3233 uses : actions/upload-artifact@v4
3334 with :
3435 name : build
3536 path : |
3637 .
3738 !node_modules
3839 retention-days : 1
40+
41+ dependabot :
42+ name : ' Dependabot'
43+ needs : build # After the E2E and build jobs, if one of them fails, it won't merge the PR.
44+ runs-on : ubuntu-latest
45+ if : ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
46+ steps :
47+ - name : Enable auto-merge for Dependabot PRs
48+ run : gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
49+ env :
50+ PR_URL : ${{github.event.pull_request.html_url}}
51+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
52+
3953 npm-publish-build :
4054 needs : build
4155 runs-on : ubuntu-latest
@@ -45,20 +59,20 @@ jobs:
4559 name : build
4660 - uses : actions/setup-node@v5
4761 with :
48- node-version : 18 .x
62+ node-version : 20 .x
4963 -
uses :
rlespinasse/[email protected] 5064 - name : Append commit hash to package version
5165 run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
5266 - name : Disable pre- and post-publish actions
5367 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
54- - uses : JS-DevTools/npm-publish@v4
68+ - uses : JS-DevTools/npm-publish@v4.1.0
5569 if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
5670 with :
5771 token : ${{ secrets.NPM_TOKEN }}
5872 tag : ${{ env.GITHUB_REF_SLUG }}
5973
6074 npm-publish-latest :
61- needs : build
75+ needs : [ build, npm-publish-build]
6276 runs-on : ubuntu-latest
6377 if : github.ref == 'refs/heads/main'
6478 steps :
@@ -67,10 +81,10 @@ jobs:
6781 name : build
6882 - uses : actions/setup-node@v5
6983 with :
70- node-version : 18 .x
84+ node-version : 20 .x
7185 - name : Disable pre- and post-publish actions
7286 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
73- - uses : JS-DevTools/npm-publish@v4
87+ - uses : JS-DevTools/npm-publish@v4.1.0
7488 if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
7589 with :
7690 token : ${{ secrets.NPM_TOKEN }}
0 commit comments