Class: Datadog::CI::Ext::Environment::Providers::GithubActions
- Inherits:
-
Base
- Object
- Base
- Datadog::CI::Ext::Environment::Providers::GithubActions
show all
- Defined in:
- lib/datadog/ci/ext/environment/providers/github_actions.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#env
Instance Method Summary
collapse
Methods inherited from Base
#git_branch, #git_commit_author_date, #git_commit_author_email, #git_commit_author_name, #git_commit_committer_date, #git_commit_committer_email, #git_commit_committer_name, #git_commit_message, #git_tag, #initialize, #node_labels, #node_name, #stage_name
Instance Method Details
#ci_env_vars ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 63
def ci_env_vars
{
"GITHUB_SERVER_URL" => env["GITHUB_SERVER_URL"],
"GITHUB_REPOSITORY" => env["GITHUB_REPOSITORY"],
"GITHUB_RUN_ID" => env["GITHUB_RUN_ID"],
"GITHUB_RUN_ATTEMPT" => env["GITHUB_RUN_ATTEMPT"]
}.reject { |_, v| v.nil? }.to_json
end
|
#git_branch_or_tag ⇒ Object
57
58
59
60
61
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 57
def git_branch_or_tag
ref = env["GITHUB_HEAD_REF"]
ref = env["GITHUB_REF"] if ref.nil? || ref.empty?
ref
end
|
#git_commit_sha ⇒ Object
53
54
55
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 53
def git_commit_sha
env["GITHUB_SHA"]
end
|
#git_repository_url ⇒ Object
49
50
51
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 49
def git_repository_url
"#{env["GITHUB_SERVER_URL"]}/#{env["GITHUB_REPOSITORY"]}.git"
end
|
#job_name ⇒ Object
19
20
21
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 19
def job_name
env["GITHUB_JOB"]
end
|
#job_url ⇒ Object
23
24
25
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 23
def job_url
"#{env["GITHUB_SERVER_URL"]}/#{env["GITHUB_REPOSITORY"]}/commit/#{env["GITHUB_SHA"]}/checks"
end
|
#pipeline_id ⇒ Object
27
28
29
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 27
def pipeline_id
env["GITHUB_RUN_ID"]
end
|
#pipeline_name ⇒ Object
31
32
33
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 31
def pipeline_name
env["GITHUB_WORKFLOW"]
end
|
#pipeline_number ⇒ Object
35
36
37
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 35
def pipeline_number
env["GITHUB_RUN_NUMBER"]
end
|
#pipeline_url ⇒ Object
39
40
41
42
43
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 39
def pipeline_url
res = "#{env["GITHUB_SERVER_URL"]}/#{env["GITHUB_REPOSITORY"]}/actions/runs/#{env["GITHUB_RUN_ID"]}"
res = "#{res}/attempts/#{env["GITHUB_RUN_ATTEMPT"]}" if env["GITHUB_RUN_ATTEMPT"]
res
end
|
#provider_name ⇒ Object
15
16
17
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 15
def provider_name
"github"
end
|
#workspace_path ⇒ Object
45
46
47
|
# File 'lib/datadog/ci/ext/environment/providers/github_actions.rb', line 45
def workspace_path
env["GITHUB_WORKSPACE"]
end
|