mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 16:31:41 +00:00
fix: obtener el usuario del repositorio
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
b06b829357
commit
84f82cbb0f
3 changed files with 20 additions and 1 deletions
1
Gemfile
1
Gemfile
|
@ -70,6 +70,7 @@ gem 'redis-rails'
|
|||
gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update'
|
||||
gem 'rubyzip'
|
||||
gem 'rugged'
|
||||
gem 'git_clone_url'
|
||||
gem 'concurrent-ruby-ext'
|
||||
gem 'que'
|
||||
gem 'symbol-fstring', require: 'fstring/all'
|
||||
|
|
|
@ -217,6 +217,8 @@ GEM
|
|||
activerecord (>= 4.0.0)
|
||||
get_process_mem (0.2.7)
|
||||
ffi (~> 1.0)
|
||||
git_clone_url (2.0.0)
|
||||
uri-ssh_git (>= 2.0)
|
||||
globalid (1.1.0)
|
||||
activesupport (>= 5.0)
|
||||
groupdate (6.2.1)
|
||||
|
@ -553,6 +555,7 @@ GEM
|
|||
unf_ext
|
||||
unf_ext (0.0.8.2-x86_64-linux-musl)
|
||||
unicode-display_width (1.8.0)
|
||||
uri-ssh_git (2.0.0)
|
||||
validates_hostname (1.0.13)
|
||||
activerecord (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
|
@ -606,6 +609,7 @@ DEPENDENCIES
|
|||
fast_jsonparser (~> 0.5.0)
|
||||
flamegraph
|
||||
friendly_id
|
||||
git_clone_url
|
||||
hairtrigger
|
||||
haml-lint
|
||||
hamlit-rails
|
||||
|
|
|
@ -173,7 +173,21 @@ class Site
|
|||
def credentials
|
||||
return unless File.exist? private_key
|
||||
|
||||
@credentials ||= Rugged::Credentials::SshKey.new username: 'git', publickey: public_key, privatekey: private_key
|
||||
@credentials ||=
|
||||
begin
|
||||
username = parse_url(origin.url)&.user || 'git'
|
||||
|
||||
Rugged::Credentials::SshKey.new username: username, publickey: public_key, privatekey: private_key
|
||||
end
|
||||
end
|
||||
|
||||
# @param :url [String]
|
||||
# @return [URI, nil]
|
||||
def parse_url(url)
|
||||
GitCloneUrl.parse(url)
|
||||
rescue URI::Error => e
|
||||
ExceptionNotifier.notify_exception(e, data: { site: site.name, url: url })
|
||||
nil
|
||||
end
|
||||
|
||||
# @return [String]
|
||||
|
|
Loading…
Reference in a new issue