diff --git a/action.yml b/action.yml index a2c53c3..7693f5d 100644 --- a/action.yml +++ b/action.yml @@ -4,16 +4,21 @@ inputs: steps: description: 'The steps to register' required: true + type: string client_id: description: 'The client ID for authentication' required: true + type: string key_secret: description: 'The key secret for authentication' required: true + type: string outputs: token_file: description: 'Path to the file containing the authentication token' runs: using: 'node12' main: 'dist/index.js' + post: 'dist/cleanup.js' + diff --git a/src/cleanup.ts b/src/cleanup.ts new file mode 100644 index 0000000..7aa42ab --- /dev/null +++ b/src/cleanup.ts @@ -0,0 +1,27 @@ +import * as core from '@actions/core'; +import * as fs from 'fs'; +import * as path from 'path'; +import * as os from 'os'; + +async function cleanup() { + try { + const tempDir = process.env.RUNNER_TEMP || os.tmpdir(); + const tokenFilePath = path.join(tempDir, 'meshstack_token.json'); + + if (fs.existsSync(tokenFilePath)) { + fs.unlinkSync(tokenFilePath); + core.info(`Deleted token file: ${tokenFilePath}`); + } else { + core.info(`Token file does not exist: ${tokenFilePath}`); + } + } catch (error) { + if (error instanceof Error) { + core.setFailed(error.message); + } else { + core.setFailed('An unknown error occurred during cleanup'); + } + } +} + +cleanup(); +