Skip to content

Commit

Permalink
Fixing problem with promise chain adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
manchicken committed Oct 24, 2024
1 parent 2560f2c commit 814a6de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35973,7 +35973,7 @@ var run = async (configs) => {
}
};
core.debug("STARTING THE PARSE");
inputsToRegistryDocument().then((configs) => {
Promise.resolve().then(() => inputsToRegistryDocument()).then((configs) => {
core.debug(`Input schema version is \xAB${core.getInput("schema-version")}\xBB`);
core.debug(
`Inputs coming off of configs: ${JSON.stringify(configs, void 0, 2)}`
Expand Down
13 changes: 7 additions & 6 deletions index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const registerWithDataDog = async (apiKey, appKey, ddHost, configJsonStr) => {
core.debug(`JSON: ${configJsonStr}`)
// Prep the auth
const client = new HttpClient(
'nodejs - GitHub Actions - arcxp/datadog-service-catalog-metadata-provider'
'nodejs - GitHub Actions - arcxp/datadog-service-catalog-metadata-provider',
)

const response = await client.post(
Expand All @@ -27,15 +27,15 @@ const registerWithDataDog = async (apiKey, appKey, ddHost, configJsonStr) => {
'DD-API-KEY': apiKey,
'DD-APPLICATION-KEY': appKey,
'Content-Type': 'application/json',
}
},
)
const statusCode = response.message.statusCode
const body = await response.readBody()
core.debug(`Response status code: ${statusCode}, with body: ${body}`)

if (statusCode !== 200) {
core.setFailed(
`Failed to register service with DataDog. Status Code: ${statusCode} Body: ${body}`
`Failed to register service with DataDog. Status Code: ${statusCode} Body: ${body}`,
)
}
}
Expand All @@ -51,7 +51,7 @@ const run = async (configs) => {

if (!apiKey || !appKey) {
return core.setFailed(
'Both `datadog-key` and `datadog-app-key` are required.'
'Both `datadog-key` and `datadog-app-key` are required.',
)
}

Expand All @@ -74,11 +74,12 @@ const run = async (configs) => {

// Grab the inputs and then run with them!
core.debug('STARTING THE PARSE')
inputsToRegistryDocument()
Promise.resolve()
.then(() => inputsToRegistryDocument())
.then((configs) => {
core.debug(`Input schema version is «${core.getInput('schema-version')}»`)
core.debug(
`Inputs coming off of configs: ${JSON.stringify(configs, undefined, 2)}`
`Inputs coming off of configs: ${JSON.stringify(configs, undefined, 2)}`,
)

return configs
Expand Down

0 comments on commit 814a6de

Please sign in to comment.