Skip to content

Commit

Permalink
chore: try to fix action
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps committed Dec 11, 2023
1 parent 309a21b commit 39498d0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
20 changes: 6 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

23 changes: 7 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ async function validate(args: string[] = []): Promise<void> {
return
}

const response = result.stdout
const response = result.stdout.toString().trim()

core.debug(`flipt response: ${response}`)

if (response.length === 0) {
Expand All @@ -61,23 +62,13 @@ async function validate(args: string[] = []): Promise<void> {
}

let errors = 0
const json = JSON.parse(response, function (key, value) {
// we want to remove all unicode control characters from the message

if (key === 'message') {
return value.replace(/[\u0000-\u001F\u007F-\u009F]/g, '')
}

return value
})
const json = JSON.parse(response)

if (!json.errors || json.errors.length === 0) {
core.debug('flipt returned no errors')
core.info('✅ No invalid files found')
return
}
// reponse looks like :
// [{"message":"flags.0.rules.0.distributions.0.rollout: invalid value 110 (out of bound \\u003c=100)","location":{"file":"features.yaml","line":17}}]
// loop through objects in response

for (const error of json.errors) {
for (const error of json) {
errors += 1
const {message, location} = error

Expand Down

0 comments on commit 39498d0

Please sign in to comment.