Class: Publisher::Providers::Info::Github
- 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
-
#build_name ⇒ String
Job name.
-
#build_url ⇒ String
Build url.
-
#client ⇒ Octokit::Client
Github api client.
-
#executor(report_url) ⇒ Hash
Executor info.
-
#pr? ⇒ Boolean
Pull request run.
-
#repository ⇒ String
Github repository.
-
#run_id ⇒ String
Run id.
-
#server_url ⇒ String
Server url.
Methods included from Helpers
allure_cli?, colorize, debug_io, #env, #env_int, error, execute_shell, log, log_debug, logger, pastel, path, reset_debug_io!
Instance Method Details
#build_name ⇒ String
Job name
61 62 63 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 61 def build_name @build_name ||= env(ALLURE_JOB_NAME) || env("GITHUB_JOB") end |
#build_url ⇒ String
Build url
75 76 77 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 75 def build_url @build_url ||= "#{server_url}/#{repository}/actions/runs/#{run_id}" end |
#client ⇒ Octokit::Client
Github api client
29 30 31 32 33 34 35 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 29 def client @client ||= begin raise("Missing GITHUB_AUTH_TOKEN environment variable!") unless ENV["GITHUB_AUTH_TOKEN"] Octokit::Client.new(access_token: ENV["GITHUB_AUTH_TOKEN"], api_endpoint: ENV["GITHUB_API_URL"]) end end |
#executor(report_url) ⇒ Hash
Executor info
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
40 41 42 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 40 def pr? env("GITHUB_EVENT_NAME") == "pull_request" end |
#repository ⇒ String
Github repository
68 69 70 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 68 def repository @repository ||= env("GITHUB_REPOSITORY") end |
#run_id ⇒ String
Run id
47 48 49 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 47 def run_id @run_id ||= env(ALLURE_RUN_ID) || env("GITHUB_RUN_ID") end |
#server_url ⇒ String
Server url
54 55 56 |
# File 'lib/allure_report_publisher/lib/providers/info/github.rb', line 54 def server_url @server_url ||= env("GITHUB_SERVER_URL") end |