forked from ahmadnassri/action-workflow-queue
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (27 loc) · 876 Bytes
/
index.js
File metadata and controls
35 lines (27 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// node modules
import { inspect } from 'util'
// packages
import core from '@actions/core'
// modules
import main from './lib/index.js'
// parse inputs
const inputs = {
token: core.getInput('github-token', { required: true }),
delay: Number(core.getInput('delay', { required: true })),
timeout: Number(core.getInput('timeout', { required: true })),
jobName: core.getInput('job-name', { required: false }) || null
}
// error handler
function errorHandler ({ message, stack, request }) {
core.error(`${message}\n${stack}`)
// debugging for API calls
if (request) {
const { method, url, body, headers } = request
core.debug(`${method} ${url}\n\n${inspect(headers)}\n\n${inspect(body)}`)
}
process.exit(1)
}
// catch errors and exit
process.on('unhandledRejection', errorHandler)
process.on('uncaughtException', errorHandler)
await main(inputs)