# frozen_string_literal: true require "base64" module NeetoCompliance class GithubAccess def self.token Base64.decode64( File.read("Gemfile.common.rb") .split("encoded_github_auth_string =")[1] .split("%{")[1] .split("}")[0] .gsub("\\r", "\r") .gsub("\\n", "\n") ).split(":")[1] end def self.latest_commit_sha(uri) JSON.parse(get(uri))["sha"] end def self.get(uri) response = Net::HTTP.get_response( URI(uri), { "Authorization" => "Bearer #{token}" }).body end end end