Merge pull request #6776 from maxim-belkin/dawid66++
GitHub Actions: get username if we don't have it
This commit is contained in:
commit
2e382cdbdf
@ -381,14 +381,13 @@ module Homebrew
|
||||
end
|
||||
|
||||
def forked_repo_info(formula, tap_full_name, backup_file)
|
||||
begin
|
||||
response = GitHub.create_fork(tap_full_name)
|
||||
# GitHub API responds immediately but fork takes a few seconds to be ready.
|
||||
sleep 3
|
||||
rescue GitHub::AuthenticationFailedError, *GitHub.api_errors => e
|
||||
formula.path.atomic_write(backup_file)
|
||||
odie "Unable to fork: #{e.message}!"
|
||||
end
|
||||
response = GitHub.create_fork(tap_full_name)
|
||||
rescue GitHub::AuthenticationFailedError, *GitHub.api_errors => e
|
||||
formula.path.atomic_write(backup_file)
|
||||
odie "Unable to fork: #{e.message}!"
|
||||
else
|
||||
# GitHub API responds immediately but fork takes a few seconds to be ready.
|
||||
sleep 1 until GitHub.check_fork_exists(tap_full_name)
|
||||
remote_url = if system("git", "config", "--local", "--get-regexp", "remote\..*\.url", "git@github.com:.*")
|
||||
response.fetch("ssh_url")
|
||||
else
|
||||
|
||||
@ -341,9 +341,16 @@ module GitHub
|
||||
end
|
||||
|
||||
def check_fork_exists(repo)
|
||||
_, username = api_credentials
|
||||
_, 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))
|
||||
|
||||
return false if json["message"] == "Not Found"
|
||||
|
||||
true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user