Class: Publisher::Providers::Info::Github

Inherits:
Base
  • Object
show all
Includes:
Helpers, Singleton
Defined in:
lib/allure_report_publisher/lib/providers/info/github.rb

Overview

Github executor info

Constant Summary

Constants inherited from Base

Base::ALLURE_JOB_NAME, Base::ALLURE_RUN_ID

Instance Method Summary collapse

Methods included from Helpers

allure_cli?, colorize, debug_io, #env, error, execute_shell, log, log_debug, logger, pastel, path, reset_debug_io!

Instance Method Details

#build_nameString

Job name

Returns:

  • (String)


50
51
52
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 50

def build_name
  @build_name ||= env(ALLURE_JOB_NAME) || env("GITHUB_JOB")
end

#build_urlString

Build url

Returns:

  • (String)


64
65
66
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 64

def build_url
  @build_url ||= "#{server_url}/#{repository}/actions/runs/#{run_id}"
end

#executor(report_url) ⇒ Hash

Executor info

Returns:

  • (Hash)


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 13

def executor(report_url)
  {
    name: "Github",
    type: "github",
    reportName: "AllureReport",
    reportUrl: report_url,
    url: server_url,
    buildUrl: build_url,
    buildOrder: run_id,
    buildName: build_name
  }
end

#pr?Boolean

Pull request run

Returns:

  • (Boolean)


29
30
31
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 29

def pr?
  env("GITHUB_EVENT_NAME") == "pull_request"
end

#repositoryString

Github repository

Returns:

  • (String)


57
58
59
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 57

def repository
  @repository ||= env("GITHUB_REPOSITORY")
end

#run_idString

Run id

Returns:

  • (String)


36
37
38
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 36

def run_id
  @run_id ||= env(ALLURE_RUN_ID) || env("GITHUB_RUN_ID")
end

#server_urlString

Server url

Returns:

  • (String)


43
44
45
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 43

def server_url
  @server_url ||= env("GITHUB_SERVER_URL")
end