From 7a4813104c19621966c7a7c978fdacedf76e107c Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Thu, 30 Oct 2025 14:43:41 +0000 Subject: [PATCH] ci: make the github action fail when a firebase command fails (#64801) When a firebase command line execution fails, the github action should be shown as failing instead of continuing to attempt to run and resulting in an exit code of 0 and success PR Close #64801 --- .github/actions/deploy-docs-site/lib/deploy.mts | 6 +++++- .github/actions/deploy-docs-site/main.js | 6 +++++- .github/actions/deploy-docs-site/tsconfig.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy-docs-site/lib/deploy.mts b/.github/actions/deploy-docs-site/lib/deploy.mts index afe44097913..867cd9446e5 100644 --- a/.github/actions/deploy-docs-site/lib/deploy.mts +++ b/.github/actions/deploy-docs-site/lib/deploy.mts @@ -103,7 +103,7 @@ export async function setupRedirect(deployment: Deployment) { } function firebase(cmd: string, cwd?: string) { - spawnSync('npx', `-y firebase-tools@13.15.1 ${cmd}`.split(' '), { + const {status} = spawnSync('npx', `-y firebase-tools@13.15.1 ${cmd}`.split(' '), { cwd, encoding: 'utf-8', shell: true, @@ -113,4 +113,8 @@ function firebase(cmd: string, cwd?: string) { GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath(), }, }); + if (status !== 0) { + console.error('Firebase command failed, see log above for details.'); + process.exit(status); + } } diff --git a/.github/actions/deploy-docs-site/main.js b/.github/actions/deploy-docs-site/main.js index 6de41f82af3..1aa9b8deace 100644 --- a/.github/actions/deploy-docs-site/main.js +++ b/.github/actions/deploy-docs-site/main.js @@ -33485,7 +33485,7 @@ async function setupRedirect(deployment) { await rm(tmpRedirectDir, { recursive: true }); } function firebase(cmd, cwd) { - spawnSync("npx", `-y firebase-tools@13.15.1 ${cmd}`.split(" "), { + const { status } = spawnSync("npx", `-y firebase-tools@13.15.1 ${cmd}`.split(" "), { cwd, encoding: "utf-8", shell: true, @@ -33495,6 +33495,10 @@ function firebase(cmd, cwd) { GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath() } }); + if (status !== 0) { + console.error("Firebase command failed, see log above for details."); + process.exit(status); + } } // diff --git a/.github/actions/deploy-docs-site/tsconfig.json b/.github/actions/deploy-docs-site/tsconfig.json index 839b2e57c4f..ddabad392d7 100644 --- a/.github/actions/deploy-docs-site/tsconfig.json +++ b/.github/actions/deploy-docs-site/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "NodeNext", "target": "ES2021", + "types": ["node"], "lib": ["es2021"], "experimentalDecorators": true, "strict": true, @@ -11,6 +12,5 @@ "noImplicitReturns": true, "declaration": true, "sourceMap": true - } } \ No newline at end of file