2
2
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
3
4
4
name : CI
5
-
5
+ permissions :
6
+ contents : write
7
+ pull-requests : write
6
8
on :
7
9
push :
8
10
branches :
24
26
- 22.x
25
27
26
28
steps :
29
+ <<<<<<< HEAD
27
30
- uses : actions/checkout@v4
28
31
- name : Use Node.js ${{ matrix.node-version }}
29
32
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
30
38
with :
31
39
node-version : ${{ matrix.node-version }}
32
40
- run : npm ci
@@ -42,41 +50,55 @@ jobs:
42
50
.
43
51
!node_modules
44
52
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
+
46
66
npm-publish-build :
47
67
needs : build
48
68
runs-on : ubuntu-latest
49
69
steps :
50
- - uses : actions/download-artifact@v4
70
+ - uses : actions/download-artifact@v5
51
71
with :
52
72
name : build
53
- - uses : actions/setup-node@v4
73
+ - uses : actions/setup-node@v5
54
74
with :
55
75
node-version : 20.x
56
76
-
uses :
rlespinasse/[email protected]
57
77
- name : Append commit hash to package version
58
78
run : ' sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
59
79
- name : Disable pre- and post-publish actions
60
80
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]'
62
83
with :
63
84
token : ${{ secrets.NPM_TOKEN }}
64
85
tag : ${{ env.GITHUB_REF_SLUG }}
65
86
66
87
npm-publish-latest :
67
- needs : build
88
+ needs : [ build, npm-publish-build]
68
89
runs-on : ubuntu-latest
69
90
if : github.ref == 'refs/heads/main'
70
91
steps :
71
- - uses : actions/download-artifact@v4
92
+ - uses : actions/download-artifact@v5
72
93
with :
73
94
name : build
74
- - uses : actions/setup-node@v4
95
+ - uses : actions/setup-node@v5
75
96
with :
76
97
node-version : 20.x
77
98
- name : Disable pre- and post-publish actions
78
99
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]'
80
102
with :
81
103
token : ${{ secrets.NPM_TOKEN }}
82
104
tag : latest
0 commit comments