License#license_key should re-use License#license_blob

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

License#license_blob already returns a blob for a license file. This means that License#license_key doesn't have to search through the project again; instead it can just re-use it. To do so we can use the following:

def license_key
  return nil unless head_exists?

  cache.fetch(:license_key) do
    blob = license_blob

    Licensee::Project::LicenseFile.new(File.read(blob.path), blob.name).license.key
  end
end

This is not tested. I'm also not sure if the API used here is supposed to be a public API.

Edited by 🤖 GitLab Bot 🤖