8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'fastlane/lib/fastlane/actions/get_github_release.rb', line 8
def self.run(params)
UI.message("Getting release on GitHub (#{params[:server_url]}/#{params[:url]}: #{params[:version]})")
GithubApiAction.run(
server_url: params[:server_url],
api_token: params[:api_token],
api_bearer: params[:api_bearer],
http_method: 'GET',
path: "repos/#{params[:url]}/releases",
error_handlers: {
404 => proc do |result|
UI.error("Repository #{params[:url]} cannot be found, please double check its name and that you provided a valid API token (if it's a private repository).")
return nil
end,
401 => proc do |result|
UI.error("You are not authorized to access #{params[:url]}, please make sure you provided a valid API token.")
return nil
end,
'*' => proc do |result|
UI.error("GitHub responded with #{result[:status]}:#{result[:body]}")
return nil
end
}
) do |result|
json = result[:json]
json.each do |current|
next unless current['tag_name'] == params[:version]
Actions.lane_context[SharedValues::GET_GITHUB_RELEASE_INFO] = current
UI.message("Version is already live on GitHub.com 🚁")
return current
end
end
UI.important("Couldn't find GitHub release #{params[:version]}")
return nil
end
|