Skip to content

Commit 25b96ba

Browse files
authored
Add linters (#499)
1 parent 0920706 commit 25b96ba

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,11 @@ jobs:
4747

4848
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
4949
with:
50-
node-version: '20.x'
50+
node-version-file: 'package.json'
5151

5252
- name: 'npm build'
5353
run: 'npm ci && npm run build'
5454

55-
- name: 'npm lint'
56-
run: 'npm run lint'
57-
5855
- name: 'npm test'
5956
run: 'npm run test'
6057

@@ -63,7 +60,8 @@ jobs:
6360
# Direct Workload Identity Federation
6461
#
6562
direct_workload_identity_federation:
66-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
63+
if: |-
64+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
6765
name: 'direct_workload_identity_federation'
6866
runs-on: '${{ matrix.os }}'
6967
strategy:
@@ -82,7 +80,7 @@ jobs:
8280

8381
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
8482
with:
85-
node-version: '20.x'
83+
node-version-file: 'package.json'
8684

8785
- name: 'npm build'
8886
run: 'npm ci && npm run build'
@@ -116,7 +114,8 @@ jobs:
116114
# Workload Identity Federation through a Service Account
117115
#
118116
workload_identity_federation_through_service_account:
119-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
117+
if: |-
118+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
120119
name: 'workload_identity_federation_through_service_account'
121120
runs-on: '${{ matrix.os }}'
122121
strategy:
@@ -135,7 +134,7 @@ jobs:
135134

136135
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
137136
with:
138-
node-version: '20.x'
137+
node-version-file: 'package.json'
139138

140139
- name: 'npm build'
141140
run: 'npm ci && npm run build'
@@ -187,7 +186,8 @@ jobs:
187186
# Service Account Key JSON
188187
#
189188
credentials_json:
190-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
189+
if: |-
190+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
191191
name: 'credentials_json'
192192
runs-on: '${{ matrix.os }}'
193193
strategy:
@@ -203,7 +203,7 @@ jobs:
203203

204204
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
205205
with:
206-
node-version: '20.x'
206+
node-version-file: 'package.json'
207207

208208
- name: 'npm build'
209209
run: 'npm ci && npm run build'
@@ -254,7 +254,8 @@ jobs:
254254
# has permissions to read the file.
255255
#
256256
docker:
257-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
257+
if: |-
258+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
258259
name: 'docker'
259260
runs-on: 'ubuntu-latest'
260261
strategy:
@@ -264,7 +265,7 @@ jobs:
264265

265266
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
266267
with:
267-
node-version: '20.x'
268+
node-version-file: 'package.json'
268269

269270
- name: 'npm build'
270271
run: 'npm ci && npm run build'

bin/runTests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ set -eEuo pipefail
1616
FILES="$(node -e "process.stdout.write(require('node:fs').readdirSync('./', { recursive: true }).filter((e) => {return e.endsWith('.test.ts') && !e.startsWith('node_modules');}).sort().join(' '));")"
1717

1818
set -x
19+
20+
# shellcheck disable=SC2086
1921
exec node --require ts-node/register --test-reporter spec --test ${FILES}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"format": "eslint . --fix",
1010
"test": "bash ./bin/runTests.sh"
1111
},
12+
"engines": {
13+
"node": "20.x",
14+
"npm": "10.x"
15+
},
1216
"repository": {
1317
"type": "git",
1418
"url": "https://github.com/google-github-actions/auth"

0 commit comments

Comments
 (0)