Module: Octokit::Client::CodeScanning
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/code_scanning.rb |
Overview
Methods for the code scanning alerts API
Instance Method Summary
-
#get_sarif_upload_information(repo, sarif_id, options = {}) ⇒ Sawyer::Resource
Gets information about a SARIF upload.
-
#upload_sarif_data(repo, file, sha, ref, options = {}) ⇒ Sawyer::Resource
Uploads SARIF data containing the results of a code scanning analysis.
- #compress_sarif_data(file) private
Instance Method Details
#compress_sarif_data(file) (private)
[ GitHub ]# File 'lib/octokit/client/code_scanning.rb', line 42
def compress_sarif_data(file) Tempfile.create('sarif.gz') do |tempfile| Zlib::GzipWriter.open(tempfile) do |gz_file| gz_file.write File.binread(file) end [tempfile.read].pack('m0') # Base64.strict_encode64 end end
#get_sarif_upload_information(repo, sarif_id, options = {}) ⇒ Sawyer::Resource
Gets information about a SARIF upload
# File 'lib/octokit/client/code_scanning.rb', line 36
def get_sarif_upload_information(repo, sarif_id, = {}) get "#{Repository.path repo}/code-scanning/sarifs/#{sarif_id}", end
#upload_sarif_data(repo, file, sha, ref, options = {}) ⇒ Sawyer::Resource
Uploads SARIF data containing the results of a code scanning analysis
# File 'lib/octokit/client/code_scanning.rb', line 21
def upload_sarif_data(repo, file, sha, ref, = {}) [:sarif] = compress_sarif_data(file) [:commit_sha] = sha [:ref] = ref post "#{Repository.path repo}/code-scanning/sarifs", end