Skip to content

Commit e909e37

Browse files
committed
Merge branch 'main' of github.com:arcxp/datadog-service-catalog-metadata-provider
2 parents 022b4da + 2f1839e commit e909e37

8 files changed

+27
-29
lines changed

.github/workflows/v2-automated-testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run: echo "date=$(date +'%Y-%m-%d -- %s')" >> $GITHUB_OUTPUT
1515

1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Run CI Tests
2020
env:

.github/workflows/v2.1-automated-testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run: echo "date=$(date +'%Y-%m-%d -- %s')" >> $GITHUB_OUTPUT
1515

1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Run CI Tests
2020
env:

.github/workflows/v2.2-automated-testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
run: echo "date=$(date +'%Y-%m-%d -- %s')" >> $GITHUB_OUTPUT
1515

1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Run CI Tests
2020
env:

__tests__/lib/input-expander.test.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ describe('input-expander.cjs - utilities', () => {
140140
{ value: 0, outcome: false },
141141
{ value: 1, outcome: false },
142142
{ value: { a: undefined }, outcome: false },
143+
{ value: '', outcome: true },
143144
])('#isNothing($value) should be $outcome', ({ value, outcome }) => {
144145
expect(isNothing(value)).toBe(outcome)
145146
})

dist/index.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32033,7 +32033,7 @@ var require_input_expander = __commonJS({
3203332033
":"
3203432034
) : entry
3203532035
);
32036-
var isNothing = (testValue) => !_.isDate(testValue) && (_.isObject(testValue) || _.isArray(testValue)) ? _.isEmpty(testValue) : _.isNil(testValue);
32036+
var isNothing = (testValue) => !_.isDate(testValue) && (_.isObject(testValue) || _.isArray(testValue) || _.isString(testValue)) ? _.isEmpty(testValue) : _.isNil(testValue);
3203732037
var combineValues = (value, key, target) => {
3203832038
if (isNothing(value)) {
3203932039
return target;
@@ -36832,7 +36832,7 @@ var { validateDatadogHostname } = require_input_validation();
3683236832
var { fetchAndApplyOrgRules } = require_org_rules();
3683336833
var registerWithDataDog = async (apiKey, appKey, ddHost, configJsonStr) => {
3683436834
DatadogPostGovernor.increment();
36835-
core.debug(`JSON: ${configJsonStr}`);
36835+
core.debug(`JSON: \xAB${configJsonStr}\xBB`);
3683636836
const client = new HttpClient(
3683736837
"nodejs - GitHub Actions - arcxp/datadog-service-catalog-metadata-provider"
3683836838
);
@@ -36875,7 +36875,7 @@ var run = async (configs) => {
3687536875
}
3687636876
};
3687736877
core.debug("STARTING THE PARSE");
36878-
inputsToRegistryDocument().then((configs) => {
36878+
Promise.resolve().then(() => inputsToRegistryDocument()).then((configs) => {
3687936879
core.debug(`Input schema version is \xAB${core.getInput("schema-version")}\xBB`);
3688036880
core.debug(
3688136881
`Inputs coming off of configs: ${JSON.stringify(configs, void 0, 2)}`

index.cjs

+8-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const { fetchAndApplyOrgRules } = require('./lib/org-rules')
1414
const registerWithDataDog = async (apiKey, appKey, ddHost, configJsonStr) => {
1515
DatadogPostGovernor.increment()
1616

17-
core.debug(`JSON: ${configJsonStr}`)
17+
core.debug(`JSON: «${configJsonStr}»`)
1818
// Prep the auth
1919
const client = new HttpClient(
20-
'nodejs - GitHub Actions - arcxp/datadog-service-catalog-metadata-provider'
20+
'nodejs - GitHub Actions - arcxp/datadog-service-catalog-metadata-provider',
2121
)
2222

2323
const response = await client.post(
@@ -27,15 +27,15 @@ const registerWithDataDog = async (apiKey, appKey, ddHost, configJsonStr) => {
2727
'DD-API-KEY': apiKey,
2828
'DD-APPLICATION-KEY': appKey,
2929
'Content-Type': 'application/json',
30-
}
30+
},
3131
)
3232
const statusCode = response.message.statusCode
3333
const body = await response.readBody()
3434
core.debug(`Response status code: ${statusCode}, with body: ${body}`)
3535

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

5252
if (!apiKey || !appKey) {
5353
return core.setFailed(
54-
'Both `datadog-key` and `datadog-app-key` are required.'
54+
'Both `datadog-key` and `datadog-app-key` are required.',
5555
)
5656
}
5757

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

7575
// Grab the inputs and then run with them!
7676
core.debug('STARTING THE PARSE')
77-
inputsToRegistryDocument()
77+
Promise.resolve()
78+
.then(() => inputsToRegistryDocument())
7879
.then((configs) => {
7980
core.debug(`Input schema version is «${core.getInput('schema-version')}»`)
8081
core.debug(
81-
`Inputs coming off of configs: ${JSON.stringify(configs, undefined, 2)}`
82+
`Inputs coming off of configs: ${JSON.stringify(configs, undefined, 2)}`,
8283
)
8384

8485
return configs

lib/input-expander.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ const parseYamlExpectDatadogTags = (str) =>
165165
* @function
166166
**/
167167
const isNothing = (testValue) =>
168-
!_.isDate(testValue) && (_.isObject(testValue) || _.isArray(testValue))
168+
!_.isDate(testValue) &&
169+
(_.isObject(testValue) || _.isArray(testValue) || _.isString(testValue))
169170
? _.isEmpty(testValue)
170171
: _.isNil(testValue)
171172

package.json

+10-15
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,27 @@
1313
"type": "git",
1414
"url": "git+https://github.com/arcxp/datadog-service-catalog-metadata-provider.git"
1515
},
16-
"keywords": [
17-
"github",
18-
"action",
19-
"datadog",
20-
"service-catalog"
21-
],
16+
"keywords": ["github", "action", "datadog", "service-catalog"],
2217
"author": "Mike Stemle <[email protected]>",
2318
"license": "MIT",
2419
"bugs": {
2520
"url": "https://github.com/arcxp/datadog-service-catalog-metadata-provider/issues"
2621
},
2722
"homepage": "https://github.com/arcxp/datadog-service-catalog-metadata-provider#readme",
2823
"dependencies": {
29-
"@actions/core": "^1.10.1",
24+
"@actions/core": "^1.11.1",
3025
"@actions/github": "^6.0.0",
31-
"@actions/http-client": "^2.2.1",
32-
"@octokit/rest": "^20.1.0",
26+
"@actions/http-client": "^2.2.3",
27+
"@octokit/rest": "^21.0.2",
3328
"lodash": "^4.17.21",
34-
"uuid": "^9.0.1",
35-
"yaml": "^2.4.1"
29+
"uuid": "^10.0.0",
30+
"yaml": "^2.6.0"
3631
},
3732
"devDependencies": {
38-
"@types/jest": "^29.5.12",
39-
"ajv": "^8.12.0",
40-
"esbuild": "0.20.2",
33+
"@types/jest": "^29.5.14",
34+
"ajv": "^8.17.1",
35+
"esbuild": "0.24.0",
4136
"jest": "^29.7.0",
42-
"prettier": "^3.2.5"
37+
"prettier": "^3.3.3"
4338
}
4439
}

0 commit comments

Comments
 (0)