From 71774c87bda9fb5a72aad79a52c280dc624ca821 Mon Sep 17 00:00:00 2001 From: Joyce Zhu Date: Tue, 24 Feb 2026 21:14:24 +0000 Subject: [PATCH 1/3] Add more error logging to Actions Looks like we need to explicitly call `core.setFailed` before `process.exit(1)` (aka what we use if anything goes wrong) if we want this to be readable in Actions logs. --- .github/actions/auth/bootstrap.js | 30 ++++++++++++++++-------------- .github/actions/file/bootstrap.js | 30 ++++++++++++++++-------------- .github/actions/find/bootstrap.js | 30 ++++++++++++++++-------------- .github/actions/fix/bootstrap.js | 30 ++++++++++++++++-------------- 4 files changed, 64 insertions(+), 56 deletions(-) diff --git a/.github/actions/auth/bootstrap.js b/.github/actions/auth/bootstrap.js index 652b56a8..d5f8680c 100644 --- a/.github/actions/auth/bootstrap.js +++ b/.github/actions/auth/bootstrap.js @@ -3,22 +3,24 @@ import fs from 'node:fs' import * as url from 'node:url' -import { spawn } from 'node:child_process' +import {spawn} from 'node:child_process' -function spawnPromisified(command, args, { quiet = false, ...options } = {}) { +import * as core from '@actions/core' + +function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) proc.stdout.setEncoding('utf8') - proc.stdout.on('data', (data) => { + proc.stdout.on('data', data => { if (!quiet) { console.log(data) } }) proc.stderr.setEncoding('utf8') - proc.stderr.on('data', (data) => { + proc.stderr.on('data', data => { console.error(data) }) - proc.on('close', (code) => { + proc.on('close', code => { if (code !== 0) { reject(code) } else { @@ -31,17 +33,15 @@ function spawnPromisified(command, args, { quiet = false, ...options } = {}) { await (async () => { // If dependencies are not vendored-in, install them at runtime. try { - await fs.accessSync( - url.fileURLToPath(new URL('./node_modules', import.meta.url)), - fs.constants.R_OK - ) + await fs.accessSync(url.fileURLToPath(new URL('./node_modules', import.meta.url)), fs.constants.R_OK) } catch { try { await spawnPromisified('npm', ['ci'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm ci failed: ${error}`) process.exit(1) } } finally { @@ -49,13 +49,15 @@ await (async () => { try { await spawnPromisified('npm', ['run', 'build'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm run build (TypeScript compilation) failed: ${error}`) process.exit(1) } // Run the main script. + core.info('Running auth Action index.js...') const action = await import('./dist/index.js') await action.default() } -})() \ No newline at end of file +})() diff --git a/.github/actions/file/bootstrap.js b/.github/actions/file/bootstrap.js index 652b56a8..ab029908 100644 --- a/.github/actions/file/bootstrap.js +++ b/.github/actions/file/bootstrap.js @@ -3,22 +3,24 @@ import fs from 'node:fs' import * as url from 'node:url' -import { spawn } from 'node:child_process' +import {spawn} from 'node:child_process' -function spawnPromisified(command, args, { quiet = false, ...options } = {}) { +import * as core from '@actions/core' + +function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) proc.stdout.setEncoding('utf8') - proc.stdout.on('data', (data) => { + proc.stdout.on('data', data => { if (!quiet) { console.log(data) } }) proc.stderr.setEncoding('utf8') - proc.stderr.on('data', (data) => { + proc.stderr.on('data', data => { console.error(data) }) - proc.on('close', (code) => { + proc.on('close', code => { if (code !== 0) { reject(code) } else { @@ -31,17 +33,15 @@ function spawnPromisified(command, args, { quiet = false, ...options } = {}) { await (async () => { // If dependencies are not vendored-in, install them at runtime. try { - await fs.accessSync( - url.fileURLToPath(new URL('./node_modules', import.meta.url)), - fs.constants.R_OK - ) + await fs.accessSync(url.fileURLToPath(new URL('./node_modules', import.meta.url)), fs.constants.R_OK) } catch { try { await spawnPromisified('npm', ['ci'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm ci failed: ${error}`) process.exit(1) } } finally { @@ -49,13 +49,15 @@ await (async () => { try { await spawnPromisified('npm', ['run', 'build'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm run build (TypeScript compilation) failed: ${error}`) process.exit(1) } // Run the main script. + core.info('Running file Action index.js...') const action = await import('./dist/index.js') await action.default() } -})() \ No newline at end of file +})() diff --git a/.github/actions/find/bootstrap.js b/.github/actions/find/bootstrap.js index 652b56a8..1ed2e2c1 100644 --- a/.github/actions/find/bootstrap.js +++ b/.github/actions/find/bootstrap.js @@ -3,22 +3,24 @@ import fs from 'node:fs' import * as url from 'node:url' -import { spawn } from 'node:child_process' +import {spawn} from 'node:child_process' -function spawnPromisified(command, args, { quiet = false, ...options } = {}) { +import * as core from '@actions/core' + +function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) proc.stdout.setEncoding('utf8') - proc.stdout.on('data', (data) => { + proc.stdout.on('data', data => { if (!quiet) { console.log(data) } }) proc.stderr.setEncoding('utf8') - proc.stderr.on('data', (data) => { + proc.stderr.on('data', data => { console.error(data) }) - proc.on('close', (code) => { + proc.on('close', code => { if (code !== 0) { reject(code) } else { @@ -31,17 +33,15 @@ function spawnPromisified(command, args, { quiet = false, ...options } = {}) { await (async () => { // If dependencies are not vendored-in, install them at runtime. try { - await fs.accessSync( - url.fileURLToPath(new URL('./node_modules', import.meta.url)), - fs.constants.R_OK - ) + await fs.accessSync(url.fileURLToPath(new URL('./node_modules', import.meta.url)), fs.constants.R_OK) } catch { try { await spawnPromisified('npm', ['ci'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + console.error(`npm ci failed: ${error}`) process.exit(1) } } finally { @@ -49,13 +49,15 @@ await (async () => { try { await spawnPromisified('npm', ['run', 'build'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + console.error(`npm run build (TypeScript compilation) failed: ${error}`) process.exit(1) } // Run the main script. + core.info('Running find Action index.js...') const action = await import('./dist/index.js') await action.default() } -})() \ No newline at end of file +})() diff --git a/.github/actions/fix/bootstrap.js b/.github/actions/fix/bootstrap.js index 652b56a8..4c5e81c1 100644 --- a/.github/actions/fix/bootstrap.js +++ b/.github/actions/fix/bootstrap.js @@ -3,22 +3,24 @@ import fs from 'node:fs' import * as url from 'node:url' -import { spawn } from 'node:child_process' +import {spawn} from 'node:child_process' -function spawnPromisified(command, args, { quiet = false, ...options } = {}) { +import * as core from '@actions/core' + +function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) proc.stdout.setEncoding('utf8') - proc.stdout.on('data', (data) => { + proc.stdout.on('data', data => { if (!quiet) { console.log(data) } }) proc.stderr.setEncoding('utf8') - proc.stderr.on('data', (data) => { + proc.stderr.on('data', data => { console.error(data) }) - proc.on('close', (code) => { + proc.on('close', code => { if (code !== 0) { reject(code) } else { @@ -31,17 +33,15 @@ function spawnPromisified(command, args, { quiet = false, ...options } = {}) { await (async () => { // If dependencies are not vendored-in, install them at runtime. try { - await fs.accessSync( - url.fileURLToPath(new URL('./node_modules', import.meta.url)), - fs.constants.R_OK - ) + await fs.accessSync(url.fileURLToPath(new URL('./node_modules', import.meta.url)), fs.constants.R_OK) } catch { try { await spawnPromisified('npm', ['ci'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm ci failed: ${error}`) process.exit(1) } } finally { @@ -49,13 +49,15 @@ await (async () => { try { await spawnPromisified('npm', ['run', 'build'], { cwd: url.fileURLToPath(new URL('.', import.meta.url)), - quiet: true + quiet: true, }) - } catch { + } catch (error) { + core.setFailed(`npm run build (TypeScript compilation) failed: ${error}`) process.exit(1) } // Run the main script. + core.info('Running fix Action index.js...') const action = await import('./dist/index.js') await action.default() } -})() \ No newline at end of file +})() From 60fa50314e2a7e82a829e252efde7c1afb364e84 Mon Sep 17 00:00:00 2001 From: Joyce Zhu Date: Tue, 24 Feb 2026 21:23:09 +0000 Subject: [PATCH 2/3] Fix mistaken `console.error` --- .github/actions/find/bootstrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/find/bootstrap.js b/.github/actions/find/bootstrap.js index 1ed2e2c1..669de3a4 100644 --- a/.github/actions/find/bootstrap.js +++ b/.github/actions/find/bootstrap.js @@ -41,7 +41,7 @@ await (async () => { quiet: true, }) } catch (error) { - console.error(`npm ci failed: ${error}`) + core.setFailed(`npm ci failed: ${error}`) process.exit(1) } } finally { @@ -52,7 +52,7 @@ await (async () => { quiet: true, }) } catch (error) { - console.error(`npm run build (TypeScript compilation) failed: ${error}`) + core.setFailed(`npm run build (TypeScript compilation) failed: ${error}`) process.exit(1) } // Run the main script. From c86988639bc3c2b8e4f8d7f07395a6b1fc67ad3b Mon Sep 17 00:00:00 2001 From: Joyce Zhu Date: Tue, 24 Feb 2026 22:40:53 +0000 Subject: [PATCH 3/3] Dynamically import `actions/core` after `ci` --- .github/actions/auth/bootstrap.js | 5 ++--- .github/actions/file/bootstrap.js | 5 ++--- .github/actions/find/bootstrap.js | 5 ++--- .github/actions/fix/bootstrap.js | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/actions/auth/bootstrap.js b/.github/actions/auth/bootstrap.js index d5f8680c..d3512e8b 100644 --- a/.github/actions/auth/bootstrap.js +++ b/.github/actions/auth/bootstrap.js @@ -5,8 +5,6 @@ import fs from 'node:fs' import * as url from 'node:url' import {spawn} from 'node:child_process' -import * as core from '@actions/core' - function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) @@ -41,10 +39,11 @@ await (async () => { quiet: true, }) } catch (error) { - core.setFailed(`npm ci failed: ${error}`) + console.error(`npm ci failed: ${error}`) process.exit(1) } } finally { + const core = await import('@actions/core') // Compile TypeScript. try { await spawnPromisified('npm', ['run', 'build'], { diff --git a/.github/actions/file/bootstrap.js b/.github/actions/file/bootstrap.js index ab029908..cb797fa7 100644 --- a/.github/actions/file/bootstrap.js +++ b/.github/actions/file/bootstrap.js @@ -5,8 +5,6 @@ import fs from 'node:fs' import * as url from 'node:url' import {spawn} from 'node:child_process' -import * as core from '@actions/core' - function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) @@ -41,10 +39,11 @@ await (async () => { quiet: true, }) } catch (error) { - core.setFailed(`npm ci failed: ${error}`) + console.error(`npm ci failed: ${error}`) process.exit(1) } } finally { + const core = await import('@actions/core') // Compile TypeScript. try { await spawnPromisified('npm', ['run', 'build'], { diff --git a/.github/actions/find/bootstrap.js b/.github/actions/find/bootstrap.js index 669de3a4..d86b0112 100644 --- a/.github/actions/find/bootstrap.js +++ b/.github/actions/find/bootstrap.js @@ -5,8 +5,6 @@ import fs from 'node:fs' import * as url from 'node:url' import {spawn} from 'node:child_process' -import * as core from '@actions/core' - function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) @@ -41,10 +39,11 @@ await (async () => { quiet: true, }) } catch (error) { - core.setFailed(`npm ci failed: ${error}`) + console.error(`npm ci failed: ${error}`) process.exit(1) } } finally { + const core = await import('@actions/core') // Compile TypeScript. try { await spawnPromisified('npm', ['run', 'build'], { diff --git a/.github/actions/fix/bootstrap.js b/.github/actions/fix/bootstrap.js index 4c5e81c1..1a86499a 100644 --- a/.github/actions/fix/bootstrap.js +++ b/.github/actions/fix/bootstrap.js @@ -5,8 +5,6 @@ import fs from 'node:fs' import * as url from 'node:url' import {spawn} from 'node:child_process' -import * as core from '@actions/core' - function spawnPromisified(command, args, {quiet = false, ...options} = {}) { return new Promise((resolve, reject) => { const proc = spawn(command, args, options) @@ -41,10 +39,11 @@ await (async () => { quiet: true, }) } catch (error) { - core.setFailed(`npm ci failed: ${error}`) + console.error(`npm ci failed: ${error}`) process.exit(1) } } finally { + const core = await import('@actions/core') // Compile TypeScript. try { await spawnPromisified('npm', ['run', 'build'], {