From 554c8df6ae6a4678956aa38bea57cff98712b342 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 17 Jul 2025 18:42:48 -0400 Subject: [PATCH] Update linters --- .github/workflows/cleanup.yml | 10 ++++++---- .github/workflows/integration.yml | 4 ++-- .github/workflows/unit.yml | 11 +++-------- bin/runTests.sh | 2 ++ package.json | 4 ++++ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 300a303..65a586d 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -23,16 +23,18 @@ jobs: - uses: 'google-github-actions/setup-gcloud@v2' # ratchet:exclude - - name: Delete services + - name: 'Delete services' + env: + PROJECT_ID: '${{ vars.PROJECT_ID }}' run: |- - gcloud config set core/project "${{ vars.PROJECT_ID }}" + gcloud config set core/project "${PROJECT_ID}" gcloud config set functions/region "us-central1" # List and delete all functions that were deployed 30 minutes ago or # earlier. The date math here is a little weird, but we're looking for # deployments "earlier than" 30 minutes ago, so it's less than since # time increases. - (IFS=$'\n'; for NAME in $(gcloud functions list --format="value(name)" --filter="updateTime < '-pt30m'"); do + (IFS=$'\n'; for NAME in $(gcloud functions list --format='value(name)' --filter='updateTime < "-pt30m"'); do echo "Deleting ${NAME}..." - gcloud functions delete ${NAME} --quiet + gcloud functions delete "${NAME}" --quiet done) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d9901b2..afe25a0 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -27,7 +27,7 @@ jobs: - uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4 with: - node-version: '20.x' + node-version-file: 'package.json' - name: 'npm build' run: 'npm ci && npm run build' @@ -57,7 +57,7 @@ jobs: - uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4 with: - node-version: '20.x' + node-version-file: 'package.json' - name: 'npm build' run: 'npm ci && npm run build' diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index a5f9d29..ee07806 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -35,20 +35,15 @@ jobs: - uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4 with: - node-version: '20.x' + node-version-file: 'package.json' - name: 'npm build' run: 'npm ci && npm run build' - - name: 'npm lint' - # There's no need to run the linter for each operating system, since it - # will find the same thing 3x and clog up the PR review. - if: ${{ matrix.os == 'ubuntu-latest' }} - run: 'npm run lint' - - id: 'auth' uses: 'google-github-actions/auth@v2' # ratchet:exclude - if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }} + if: |- + ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }} with: project_id: '${{ vars.PROJECT_ID }}' workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}' diff --git a/bin/runTests.sh b/bin/runTests.sh index 2c6c21e..c47d2f8 100644 --- a/bin/runTests.sh +++ b/bin/runTests.sh @@ -16,4 +16,6 @@ set -eEuo pipefail 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(' '));")" set -x + +# shellcheck disable=SC2086 exec node --require ts-node/register --test-reporter spec --test ${FILES} diff --git a/package.json b/package.json index e724c76..6b02de5 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ "format": "eslint . --fix", "test": "bash ./bin/runTests.sh" }, + "engines": { + "node": "20.x", + "npm": "10.x" + }, "repository": { "type": "git", "url": "https://github.com/google-github-actions/deploy-cloud-functions"