Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created April 7, 2023 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamelafox/3c38ad8354d6965ac7993258298730af to your computer and use it in GitHub Desktop.
Save pamelafox/3c38ad8354d6965ac7993258298730af to your computer and use it in GitHub Desktop.
Test Github API CodeQL endpoint with sarif upload
response=$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/pamelafox/pamelafox-site/code-scanning/sarifs \
-f commit_sha='d9b327639e4e84337b9edd297a8cfb098bbfeefa' \
-f ref='refs/heads/a11y' \
-f sarif=$(gzip -c src/tests/axe_results.sarif | base64 -b 0))
url=$(echo $response | grep -o '"url": *"[^"]*"' | cut -d '"' -f 4)
# Wait a few seconds for processing to complete
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment