Skip to content

Commit

Permalink
Update the script for final tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abstractj committed Oct 16, 2024
1 parent 7919b94 commit 01755dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/scripts/snyk-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ check_github_issue_exists() {
if printf "%s" "$response" | jq -e '.message == "Bad credentials"' > /dev/null; then
printf "Error: Bad credentials\n%s\n" "$response"
echo "Error: Bad credentials. Aborting script."
exit 1
return 1
fi

# Check for rate limiting
if printf "%s" "$response" | jq -e '.message == "API rate limit exceeded"' > /dev/null; then
printf "Error: API rate limit exceeded\n%s\n" "$response"
exit 1
return 1
fi

# Check if total_count is available
if [[ $count == "null" ]]; then
printf "Error: total_count not available in response\n%s\n" "$response"
exit 1
return 1
fi

if [[ $count -gt 0 ]]; then
local issue_id=$(echo "$response" | jq -r '.items[0].number')
echo "$issue_id"
else
echo "1"
return 1
fi
}

Expand Down Expand Up @@ -97,6 +97,7 @@ parse_and_process_vulnerabilities() {

printf -v body "%s\n%s\n%s\n%s" "$title" "$module" "$from_path" "$description"
issue_id=$(check_github_issue_exists "$cve_title")

if [[ $issue_id -eq 1 ]]; then
create_github_issue "$title" "$body"
else
Expand Down

0 comments on commit 01755dd

Please sign in to comment.