Merge pull request #16000 from MikeMcQuaid/gitlab_shared_audit_fix

utils/shared_audits: handle 404 metadata errors from GitLab API.
This commit is contained in:
Mike McQuaid 2023-09-13 09:48:07 +01:00 committed by GitHub
commit 24de357fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,9 @@ module SharedAudits
@gitlab_repo_data ||= {} @gitlab_repo_data ||= {}
@gitlab_repo_data["#{user}/#{repo}"] ||= begin @gitlab_repo_data["#{user}/#{repo}"] ||= begin
out, _, status = Utils::Curl.curl_output("https://gitlab.com/api/v4/projects/#{user}%2F#{repo}") out, _, status = Utils::Curl.curl_output("https://gitlab.com/api/v4/projects/#{user}%2F#{repo}")
JSON.parse(out) if status.success? json = JSON.parse(out) if status.success?
json = nil if json&.dig("message")&.include?("404 Project Not Found")
json
end end
end end