diff --git a/app/models/concerns/project/github_api.rb b/app/models/concerns/project/github_api.rb index 20c5a0297..f437c970d 100644 --- a/app/models/concerns/project/github_api.rb +++ b/app/models/concerns/project/github_api.rb @@ -2,24 +2,23 @@ module Project::GithubApi extend ActiveSupport::Concern def github_data - Github.repos.get user: org, repo: name rescue nil + Github.repos.get user: github_get_organization, repo: name rescue nil end def github_branches - Github.repos.branches user: org, repo: name rescue nil + Github.repos.branches user: github_get_organization, repo: name rescue nil end def github_tags - Github.repos.tags user: org, repo: name rescue nil + Github.repos.tags user: github_get_organization, repo: name rescue nil end def github_get_commit(hash) - Github.repos.commits.list user: org, repo: name, sha: hash rescue nil + Github.repos.commits.list user: github_get_organization, repo: name, sha: hash rescue nil end - private - - def org - github_organization || APP_CONFIG["github_organization"] + def github_get_organization + return APP_CONFIG['github_organization'] if github_organization.empty? + github_organization end end \ No newline at end of file diff --git a/app/views/projects/project/project/error_github.html.slim b/app/views/projects/project/project/error_github.html.slim index be8ea7c90..1e31b6bd4 100644 --- a/app/views/projects/project/project/error_github.html.slim +++ b/app/views/projects/project/project/error_github.html.slim @@ -1,4 +1,4 @@ =render 'submenu' .col-xs-12.col-md-10.col-md-offset-1 .row - .alert.alert-danger.text-center=t('layout.projects.no_github_repo_error', organization:@project.github_data || APP_CONFIG['github_organization']) \ No newline at end of file + .alert.alert-danger.text-center=t('layout.projects.no_github_repo_error', organization:@project.github_get_organization) \ No newline at end of file diff --git a/config/initializers/github.rb b/config/initializers/github.rb index 86566c727..d88446488 100644 --- a/config/initializers/github.rb +++ b/config/initializers/github.rb @@ -1,6 +1,7 @@ #configuration of Github api gem Github.configure do |c| + puts ENV["GITHUB_LOGIN"] c.basic_auth = ENV["GITHUB_LOGIN"] + ":" + ENV["GITHUB_PASSWORD"] c.auto_pagination = true c.stack do |builder|