Files
hello-world-javascript-action/src/main.js
2025-01-08 11:40:16 -05:00

27 lines
784 B
JavaScript

import * as core from '@actions/core'
import * as github from '@actions/github'
/**
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
export async function run() {
try {
// The `who-to-greet` input is defined in action metadata file
const whoToGreet = core.getInput('who-to-greet', { required: true })
core.info(`Hello, ${whoToGreet}!`)
// Get the current time and set as an output
const time = new Date().toTimeString()
core.setOutput('time', time)
// Output the payload for debugging
core.info(
`The event payload: ${JSON.stringify(github.context.payload, null, 2)}`
)
} catch (error) {
// Fail the workflow step if an error occurs
core.setFailed(error.message)
}
}