-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.ts
More file actions
42 lines (40 loc) · 1.03 KB
/
main.ts
File metadata and controls
42 lines (40 loc) · 1.03 KB
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
36
37
38
39
40
41
42
import * as core from '@actions/core'
import { upload } from './upload'
/**
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
export async function run(): Promise<void> {
try {
const apiKey: string = core.getInput('api-key', {
required: true
})
const baseUrl: string = core.getInput('base-url', {
required: false
})
const dryRun: boolean =
core.getInput('dry-run', {
required: false
}) === 'true'
const pathToFile: string = core.getInput('path-to-file', {
required: true
})
const tags: string = core.getInput('tags', {
required: false
})
core.debug(`Path to OpenAPI: ${pathToFile}`)
core.debug(`Upload started: ${new Date().toTimeString()}`)
await upload({
apiKey,
baseUrl,
dryRun,
pathToFile,
tags
})
core.debug(`Upload completed: ${new Date().toTimeString()}`)
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message)
}
}
}