Skip to content

Commit f58034c

Browse files
authored
fix: Prevent duplicate issues from jq errors in the “normalize_cache” step (#10)
This PR prevents duplicate issues from being opened after repeated workflow runs by fixing two `jq` errors in the “normalize_cache” step: - `jq: error (at <stdin>:1): Cannot check whether boolean has a string key` was fixed by wrapping `(.[0] | has("issueUrl"))` so `has()` runs only after confirming a non-empty array, avoiding `has()` on a boolean. - `jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped` was fixed by using `printf '%s'` instead of `echo` to preserve literal escape sequences (`\n`, etc.).
2 parents bad0af6 + 62f2bb4 commit f58034c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ runs:
5454
# If cached data is a list of Finding objects, each with 'issueUrl' keys (i.e. v1),
5555
# convert to a list of (partial) Result objects, each with 'findings' and 'issue' keys (i.e. v2).
5656
# Otherwise, re-output as-is.
57-
echo "value=$(echo '${{ steps.restore.outputs.value }}' | jq 'if (type == "array" and length > 0 and .[0] | has("issueUrl")) then map({findings: [del(.issueUrl)], issue: {url: .issueUrl}}) else . end' )" >> $GITHUB_OUTPUT
57+
echo "value=$(printf '%s' '${{ steps.restore.outputs.value }}' | jq 'if (type == "array" and length > 0 and (.[0] | has("issueUrl"))) then map({findings: [del(.issueUrl)], issue: {url: .issueUrl}}) else . end' )" >> $GITHUB_OUTPUT
5858
- if: ${{ inputs.login_url && inputs.username && inputs.password && !inputs.auth_context }}
5959
name: Authenticate
6060
id: auth

0 commit comments

Comments
 (0)