generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from masci/regression
Fix performance regression
- Loading branch information
Showing
5 changed files
with
93 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import * as core from '@actions/core' | ||
import {run} from './run' | ||
|
||
run() | ||
.catch(err => { | ||
core.setFailed(err.message) | ||
process.exit(1) | ||
}) | ||
.then(() => { | ||
process.exit(0) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,26 @@ | ||
import * as core from '@actions/core' | ||
import * as dd from './datadog' | ||
import * as yaml from 'js-yaml' | ||
import * as dd from './datadog' | ||
|
||
export async function run(): Promise<void> { | ||
try { | ||
const apiKey: string = core.getInput('api-key', {required: true}) | ||
const apiURL: string = | ||
core.getInput('api-url') || 'https://api.datadoghq.com' | ||
const apiKey: string = core.getInput('api-key', {required: true}) | ||
const apiURL: string = core.getInput('api-url') || 'https://api.datadoghq.com' | ||
|
||
const metrics: dd.Metric[] = | ||
(yaml.safeLoad(core.getInput('metrics')) as dd.Metric[]) || [] | ||
await dd.sendMetrics(apiURL, apiKey, metrics) | ||
const metrics: dd.Metric[] = | ||
(yaml.safeLoad(core.getInput('metrics')) as dd.Metric[]) || [] | ||
await dd.sendMetrics(apiURL, apiKey, metrics) | ||
|
||
const events: dd.Event[] = | ||
(yaml.safeLoad(core.getInput('events')) as dd.Event[]) || [] | ||
await dd.sendEvents(apiURL, apiKey, events) | ||
const events: dd.Event[] = | ||
(yaml.safeLoad(core.getInput('events')) as dd.Event[]) || [] | ||
await dd.sendEvents(apiURL, apiKey, events) | ||
|
||
const serviceChecks: dd.ServiceCheck[] = | ||
(yaml.safeLoad(core.getInput('service-checks')) as dd.ServiceCheck[]) || | ||
[] | ||
await dd.sendServiceChecks(apiURL, apiKey, serviceChecks) | ||
const serviceChecks: dd.ServiceCheck[] = | ||
(yaml.safeLoad(core.getInput('service-checks')) as dd.ServiceCheck[]) || [] | ||
await dd.sendServiceChecks(apiURL, apiKey, serviceChecks) | ||
|
||
const logApiURL: string = | ||
core.getInput('log-api-url') || 'https://http-intake.logs.datadoghq.com' | ||
const logs: dd.Log[] = | ||
(yaml.safeLoad(core.getInput('logs')) as dd.Log[]) || [] | ||
await dd.sendLogs(logApiURL, apiKey, logs) | ||
} catch (error) { | ||
core.setFailed(`Run failed: ${error.message}`) | ||
} | ||
const logApiURL: string = | ||
core.getInput('log-api-url') || 'https://http-intake.logs.datadoghq.com' | ||
const logs: dd.Log[] = | ||
(yaml.safeLoad(core.getInput('logs')) as dd.Log[]) || [] | ||
await dd.sendLogs(logApiURL, apiKey, logs) | ||
} |