mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
22 lines
596 B
TypeScript
22 lines
596 B
TypeScript
import * as core from '@actions/core'
|
|
import { context, getOctokit } from '@actions/github'
|
|
import * as io from '@actions/io'
|
|
|
|
process.on('unhandledRejection', handleError)
|
|
main().catch(handleError)
|
|
|
|
async function main(): Promise<void> {
|
|
const token = process.argv[2]
|
|
const fnName = process.argv[3]
|
|
const github = getOctokit(token)
|
|
|
|
const fn = await import(`./${fnName}.ts`)
|
|
fn.default(github, context, core, io)
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
function handleError(err: any): void {
|
|
console.error(err)
|
|
core.setFailed(`Unhandled error: ${err}`)
|
|
}
|