mirror of
https://github.com/actions/javascript-action.git
synced 2025-12-11 21:26:52 +00:00
Convert to ESM
This commit is contained in:
15
src/main.js
15
src/main.js
@@ -1,13 +1,14 @@
|
||||
const core = require('@actions/core')
|
||||
const { wait } = require('./wait')
|
||||
import * as core from '@actions/core'
|
||||
import { wait } from './wait.js'
|
||||
|
||||
/**
|
||||
* The main function for the action.
|
||||
*
|
||||
* @returns {Promise<void>} Resolves when the action is complete.
|
||||
*/
|
||||
async function run() {
|
||||
export async function run() {
|
||||
try {
|
||||
const ms = core.getInput('milliseconds', { required: true })
|
||||
const ms = core.getInput('milliseconds')
|
||||
|
||||
// Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
|
||||
core.debug(`Waiting ${ms} milliseconds ...`)
|
||||
@@ -21,10 +22,6 @@ async function run() {
|
||||
core.setOutput('time', new Date().toTimeString())
|
||||
} catch (error) {
|
||||
// Fail the workflow run if an error occurs
|
||||
core.setFailed(error.message)
|
||||
if (error instanceof Error) core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
run
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user