4343 .
4444 !node_modules
4545 retention-days : 1
46-
46+
47+ dependabot :
48+ name : ' Dependabot'
49+ needs : build # After the E2E and build jobs, if one of them fails, it won't merge the PR.
50+ runs-on : ubuntu-latest
51+ if : ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
52+ steps :
53+ - name : Enable auto-merge for Dependabot PRs
54+ run : gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
55+ env :
56+ PR_URL : ${{github.event.pull_request.html_url}}
57+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
58+
4759 npm-publish-build :
4860 needs : build
4961 runs-on : ubuntu-latest
@@ -59,14 +71,14 @@ jobs:
5971 run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
6072 - name : Disable pre- and post-publish actions
6173 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
62- - uses : JS-DevTools/npm-publish@v3 .1.1
74+ - uses : JS-DevTools/npm-publish@v4 .1.0
6375 if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
6476 with :
6577 token : ${{ secrets.NPM_TOKEN }}
6678 tag : ${{ env.GITHUB_REF_SLUG }}
6779
6880 npm-publish-latest :
69- needs : build
81+ needs : [ build, npm-publish-build]
7082 runs-on : ubuntu-latest
7183 if : github.ref == 'refs/heads/main'
7284 steps :
7890 node-version : 20.x
7991 - name : Disable pre- and post-publish actions
8092 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
81- - uses : JS-DevTools/npm-publish@v3 .1.1
93+ - uses : JS-DevTools/npm-publish@v4 .1.0
8294 if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
8395 with :
8496 token : ${{ secrets.NPM_TOKEN }}
0 commit comments