GitHub Actions: get username if we don't have it

This commit is contained in:
Maxim Belkin 2019-11-25 16:43:29 -06:00
parent 83d851351a
commit 2735663dc3
No known key found for this signature in database
GPG Key ID: AC71560D4C5F2338

View File

@ -341,9 +341,16 @@ module GitHub
end end
def check_fork_exists(repo) def check_fork_exists(repo)
_, username = api_credentials
_, reponame = repo.split("/") _, reponame = repo.split("/")
case api_credentials_type
when :keychain
_, username = api_credentials
when :environment
username = open_api(url_to("user")) { |json| json["login"] }
end
json = open_api(url_to("repos", username, reponame)) json = open_api(url_to("repos", username, reponame))
return false if json["message"] == "Not Found" return false if json["message"] == "Not Found"
true true