Skip to content

Commit c4e1da2

Browse files
committed
Add linters
1 parent 0920706 commit c4e1da2

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ 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'
@@ -63,7 +63,8 @@ jobs:
6363
# Direct Workload Identity Federation
6464
#
6565
direct_workload_identity_federation:
66-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
66+
if: |-
67+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
6768
name: 'direct_workload_identity_federation'
6869
runs-on: '${{ matrix.os }}'
6970
strategy:
@@ -82,7 +83,7 @@ jobs:
8283

8384
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
8485
with:
85-
node-version: '20.x'
86+
node-version-file: 'package.json'
8687

8788
- name: 'npm build'
8889
run: 'npm ci && npm run build'
@@ -116,7 +117,8 @@ jobs:
116117
# Workload Identity Federation through a Service Account
117118
#
118119
workload_identity_federation_through_service_account:
119-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
120+
if: |-
121+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
120122
name: 'workload_identity_federation_through_service_account'
121123
runs-on: '${{ matrix.os }}'
122124
strategy:
@@ -135,7 +137,7 @@ jobs:
135137

136138
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
137139
with:
138-
node-version: '20.x'
140+
node-version-file: 'package.json'
139141

140142
- name: 'npm build'
141143
run: 'npm ci && npm run build'
@@ -187,7 +189,8 @@ jobs:
187189
# Service Account Key JSON
188190
#
189191
credentials_json:
190-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
192+
if: |-
193+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
191194
name: 'credentials_json'
192195
runs-on: '${{ matrix.os }}'
193196
strategy:
@@ -203,7 +206,7 @@ jobs:
203206

204207
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
205208
with:
206-
node-version: '20.x'
209+
node-version-file: 'package.json'
207210

208211
- name: 'npm build'
209212
run: 'npm ci && npm run build'
@@ -254,7 +257,8 @@ jobs:
254257
# has permissions to read the file.
255258
#
256259
docker:
257-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
260+
if: |-
261+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
258262
name: 'docker'
259263
runs-on: 'ubuntu-latest'
260264
strategy:
@@ -264,7 +268,7 @@ jobs:
264268

265269
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
266270
with:
267-
node-version: '20.x'
271+
node-version-file: 'package.json'
268272

269273
- name: 'npm build'
270274
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)