Merge branch 'main' into feature/pass-toolsets

This commit is contained in:
Maarten van Diemen
2025-11-30 22:08:41 +01:00
8 changed files with 193 additions and 92 deletions

View File

@@ -18,11 +18,6 @@ import {
* @returns Resolves when the action is complete.
*/
export async function run(): Promise<void> {
let responseFile: tmp.FileResult | null = null
// Set up graceful cleanup for temporary files on process exit
tmp.setGracefulCleanup()
try {
const promptFilePath = core.getInput('prompt-file')
const inputVariables = core.getInput('input')
@@ -102,10 +97,13 @@ export async function run(): Promise<void> {
core.setOutput('response', modelResponse || '')
// Create a secure temporary file instead of using the temp directory directly
responseFile = tmp.fileSync({
// Create a temporary file for the response that persists for downstream steps.
// We use keep: true to prevent automatic cleanup - the file will be cleaned up
// by the runner when the job completes.
const responseFile = tmp.fileSync({
prefix: 'modelResponse-',
postfix: '.txt',
keep: true,
})
core.setOutput('response-file', responseFile.name)
@@ -121,16 +119,6 @@ export async function run(): Promise<void> {
}
// Force exit to prevent hanging on open connections
process.exit(1)
} finally {
// Explicit cleanup of temporary file if it was created
if (responseFile) {
try {
responseFile.removeCallback()
} catch (cleanupError) {
// Log cleanup errors but don't fail the action
core.warning(`Failed to cleanup temporary file: ${cleanupError}`)
}
}
}
// Force exit to prevent hanging on open connections