mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 18:46:22 +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 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update'
|
||||||
gem 'rubyzip'
|
gem 'rubyzip'
|
||||||
gem 'rugged'
|
gem 'rugged'
|
||||||
|
gem 'git_clone_url'
|
||||||
gem 'concurrent-ruby-ext'
|
gem 'concurrent-ruby-ext'
|
||||||
gem 'que'
|
gem 'que'
|
||||||
gem 'symbol-fstring', require: 'fstring/all'
|
gem 'symbol-fstring', require: 'fstring/all'
|
||||||
|
|
|
@ -217,6 +217,8 @@ GEM
|
||||||
activerecord (>= 4.0.0)
|
activerecord (>= 4.0.0)
|
||||||
get_process_mem (0.2.7)
|
get_process_mem (0.2.7)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
|
git_clone_url (2.0.0)
|
||||||
|
uri-ssh_git (>= 2.0)
|
||||||
globalid (1.1.0)
|
globalid (1.1.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
groupdate (6.2.1)
|
groupdate (6.2.1)
|
||||||
|
@ -553,6 +555,7 @@ GEM
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.8.2-x86_64-linux-musl)
|
unf_ext (0.0.8.2-x86_64-linux-musl)
|
||||||
unicode-display_width (1.8.0)
|
unicode-display_width (1.8.0)
|
||||||
|
uri-ssh_git (2.0.0)
|
||||||
validates_hostname (1.0.13)
|
validates_hostname (1.0.13)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
|
@ -606,6 +609,7 @@ DEPENDENCIES
|
||||||
fast_jsonparser (~> 0.5.0)
|
fast_jsonparser (~> 0.5.0)
|
||||||
flamegraph
|
flamegraph
|
||||||
friendly_id
|
friendly_id
|
||||||
|
git_clone_url
|
||||||
hairtrigger
|
hairtrigger
|
||||||
haml-lint
|
haml-lint
|
||||||
hamlit-rails
|
hamlit-rails
|
||||||
|
|
|
@ -173,7 +173,21 @@ class Site
|
||||||
def credentials
|
def credentials
|
||||||
return unless File.exist? private_key
|
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
|
end
|
||||||
|
|
||||||
# @return [String]
|
# @return [String]
|
||||||
|
|
Loading…
Reference in a new issue