Skip to content

Commit 9a9973f

Browse files
committed
ci: add Node.js test & automerge for dependabot
1 parent 5ae5fb7 commit 9a9973f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/node.js.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Node.js CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ${{matrix.os}}
15+
strategy:
16+
matrix:
17+
node-version: [20.x, 22.x]
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
fail-fast: false
20+
steps:
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
- name: Install dependencies
32+
run: npm i
33+
- name: Build
34+
run: npm run build
35+
- name: Lint
36+
run: npm run lint
37+
- name: Run tests
38+
run: npm run test
39+
automerge:
40+
if: >
41+
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
42+
needs:
43+
- test
44+
runs-on: ubuntu-latest
45+
permissions:
46+
contents: write
47+
pull-requests: write
48+
steps:
49+
- name: Merge Dependabot PR
50+
uses: fastify/github-action-merge-dependabot@e820d631adb1d8ab16c3b93e5afe713450884a4a # v3.11.1
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)