22# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33
44name : CI
5-
5+ permissions :
6+ contents : write
7+ pull-requests : write
68on :
79 push :
810 branches :
2426 - 22.x
2527
2628 steps :
29+ <<<<<<< HEAD
2730 - uses : actions/checkout@v4
2831 - name : Use Node.js ${{ matrix.node-version }}
2932 uses : actions/setup-node@v4
33+ =======
34+ - uses : actions/checkout@v5
35+ - name : Use Node.js ${{ matrix.node-version }}
36+ uses : actions/setup-node@v5
37+ >>>>>>> main
3038 with :
3139 node-version : ${{ matrix.node-version }}
3240 - run : npm ci
@@ -42,41 +50,55 @@ jobs:
4250 .
4351 !node_modules
4452 retention-days : 1
45-
53+
54+ dependabot :
55+ name : ' Dependabot'
56+ needs : build # After the E2E and build jobs, if one of them fails, it won't merge the PR.
57+ runs-on : ubuntu-latest
58+ if : ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
59+ steps :
60+ - name : Enable auto-merge for Dependabot PRs
61+ run : gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
62+ env :
63+ PR_URL : ${{github.event.pull_request.html_url}}
64+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
65+
4666 npm-publish-build :
4767 needs : build
4868 runs-on : ubuntu-latest
4969 steps :
50- - uses : actions/download-artifact@v4
70+ - uses : actions/download-artifact@v5
5171 with :
5272 name : build
53- - uses : actions/setup-node@v4
73+ - uses : actions/setup-node@v5
5474 with :
5575 node-version : 20.x
5676 -
uses :
rlespinasse/[email protected] 5777 - name : Append commit hash to package version
5878 run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
5979 - name : Disable pre- and post-publish actions
6080 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
61- - uses : JS-DevTools/npm-publish@v2
81+ -
uses :
JS-DevTools/[email protected] 82+ if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
6283 with :
6384 token : ${{ secrets.NPM_TOKEN }}
6485 tag : ${{ env.GITHUB_REF_SLUG }}
6586
6687 npm-publish-latest :
67- needs : build
88+ needs : [ build, npm-publish-build]
6889 runs-on : ubuntu-latest
6990 if : github.ref == 'refs/heads/main'
7091 steps :
71- - uses : actions/download-artifact@v4
92+ - uses : actions/download-artifact@v5
7293 with :
7394 name : build
74- - uses : actions/setup-node@v4
95+ - uses : actions/setup-node@v5
7596 with :
7697 node-version : 20.x
7798 - name : Disable pre- and post-publish actions
7899 run : ' sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
79- - uses : JS-DevTools/npm-publish@v2
100+ -
uses :
JS-DevTools/[email protected] 101+ if : github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
80102 with :
81103 token : ${{ secrets.NPM_TOKEN }}
82104 tag : latest
0 commit comments