Skip to content

Commit

Permalink
Fix curl Argument list too long by using a payload.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoberezhniy authored and jamacku committed Apr 26, 2024
1 parent 8eb68d6 commit 6f5a5b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,15 @@ is_debug () {
uploadSARIF () {
is_debug && local verbose=--verbose

echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json

local curl_args=(
"${verbose:---silent}"
-X PUT
-f "https://api.github.com/repos/${GITHUB_REPOSITORY}/code-scanning/analysis"
-H "Authorization: token ${INPUT_TOKEN}"
-H "Accept: application/vnd.github.v3+json"
-d '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}'
-d "@payload.json"
)

if curl "${curl_args[@]}" &> curl_std; then
Expand Down

0 comments on commit 6f5a5b5

Please sign in to comment.