Files
container-toolkit-action/src/main.ts
T

28 lines
830 B
TypeScript
Raw Normal View History

2023-09-15 12:32:25 -04:00
import * as core from '@actions/core'
2025-01-08 11:58:58 -05:00
import { wait } from './wait.js'
2019-08-02 09:09:37 -04:00
2023-09-15 12:32:25 -04:00
/**
* The main function for the action.
2025-01-08 11:58:58 -05:00
*
* @returns Resolves when the action is complete.
2023-09-15 12:32:25 -04:00
*/
export async function run(): Promise<void> {
2019-08-02 09:09:37 -04:00
try {
2025-01-08 11:58:58 -05:00
const ms: string = core.getInput('milliseconds')
2019-08-02 09:09:37 -04:00
2023-09-15 12:32:25 -04:00
// Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
2025-01-08 11:58:58 -05:00
core.debug(`Waiting ${ms} milliseconds ...`)
2023-09-15 12:32:25 -04:00
// Log the current timestamp, wait, then log the new timestamp
2025-01-08 11:58:58 -05:00
core.debug(new Date().toTimeString())
await wait(parseInt(ms, 10))
core.debug(new Date().toTimeString())
2023-09-15 12:32:25 -04:00
// Set outputs for other workflow steps to use
core.setOutput('time', new Date().toTimeString())
2019-08-02 09:09:37 -04:00
} catch (error) {
2023-09-15 12:32:25 -04:00
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
2019-08-02 09:09:37 -04:00
}
}