Class: ShaResolver
- Inherits:
-
Object
- Object
- ShaResolver
- Defined in:
- lib/sha_resolver.rb
Constant Summary collapse
- API_BASE =
"https://api.github.com"
Instance Method Summary collapse
-
#initialize(token: nil) ⇒ ShaResolver
constructor
A new instance of ShaResolver.
- #resolve(owner_action, tag) ⇒ Object
Constructor Details
#initialize(token: nil) ⇒ ShaResolver
Returns a new instance of ShaResolver.
8 9 10 11 |
# File 'lib/sha_resolver.rb', line 8 def initialize(token: nil) @token = token || ENV["GITHUB_TOKEN"] @cache = {} end |
Instance Method Details
#resolve(owner_action, tag) ⇒ Object
13 14 15 16 17 |
# File 'lib/sha_resolver.rb', line 13 def resolve(owner_action, tag) repo = extract_repo(owner_action) key = "#{repo}@#{tag}" @cache[key] ||= fetch_sha(repo, tag) end |