Skip to content

Commit

Permalink
adding vars also to action
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Nov 7, 2024
1 parent 82d06cc commit 0d6cd4d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'


27 changes: 27 additions & 0 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit 0d6cd4d

Please sign in to comment.