build_url

in app/serializers/import/github_failure_entity.rb [99:164]


    def build_url(failure)
      project = failure.project
      gh_identifiers = failure.external_identifiers
      github_repo = project.import_source

      host = host(project.import_url)
      return '' unless host

      case gh_identifiers['object_type']
      when 'pull_request', 'pull_request_merged_by'
        
        "#{host}/#{github_repo}/pull/#{gh_identifiers['iid']}"
      when 'pull_request_review_request'
        
        "#{host}/#{github_repo}/pull/#{gh_identifiers['merge_request_iid']}"
      when 'pull_request_review'
        
        "#{host}/#{github_repo}/pull/#{gh_identifiers['merge_request_iid']}" \
        "#pullrequestreview-#{gh_identifiers['review_id']}"
      when 'issue'
        
        "#{host}/#{github_repo}/issues/#{gh_identifiers['iid']}"
      when 'collaborator'
        
        "#{host}/#{gh_identifiers['login']}"
      when 'protected_branch'
        branch = escape(gh_identifiers['id'])

        
        "#{host}/#{github_repo}/tree/#{branch}"
      when 'issue_event'
        
        "#{host}/#{github_repo}/issues/#{gh_identifiers['issuable_iid']}#event-#{gh_identifiers['id']}"
      when 'label'
        label = escape(gh_identifiers['title'])

        
        "#{host}/#{github_repo}/labels/#{label}"
      when 'milestone'
        
        "#{host}/#{github_repo}/milestone/#{gh_identifiers['iid']}"
      when 'release', 'release_attachment'
        tag = escape(gh_identifiers['tag'])

        
        "#{host}/#{github_repo}/releases/tag/#{tag}"
      when 'note'
        
        "#{host}/#{github_repo}/issues/#{gh_identifiers['noteable_iid']}#issuecomment-#{gh_identifiers['note_id']}"
      when 'diff_note'
        
        "#{host}/#{github_repo}/pull/#{gh_identifiers['noteable_iid']}#discussion_r#{gh_identifiers['note_id']}"
      when 'issue_attachment'
        
        "#{host}/#{github_repo}/issues/#{gh_identifiers['noteable_iid']}"
      when 'merge_request_attachment'
        
        "#{host}/#{github_repo}/pull/#{gh_identifiers['noteable_iid']}"
      when 'lfs_object', 'note_attachment'
        
        ''
      else
        ''
      end
    end