Class: ChatNotifier::TestEnvironment::Github

Inherits:
ChatNotifier::TestEnvironment show all
Defined in:
lib/chat_notifier/test_environment/github.rb

Instance Attribute Summary

Attributes inherited from ChatNotifier::TestEnvironment

#settings

Instance Method Summary collapse

Methods inherited from ChatNotifier::TestEnvironment

for, #initialize, #job_identifier, #ruby_version, #url

Constructor Details

This class inherits a constructor from ChatNotifier::TestEnvironment

Instance Method Details

#pull_request_refObject



27
28
29
30
# File 'lib/chat_notifier/test_environment/github.rb', line 27

def pull_request_ref
  ref = settings.fetch("GITHUB_HEAD_REF", nil)
  ref unless ref.nil? || ref.empty?
end

#run_idObject



10
11
12
13
14
# File 'lib/chat_notifier/test_environment/github.rb', line 10

def run_id
  settings.fetch("NOTIFY_TEST_RUN_ID") do
    settings.fetch("GITHUB_RUN_ID", nil)
  end
end

#run_keyObject

"Re-run failed jobs" reuses GITHUB_RUN_ID (only GITHUB_RUN_ATTEMPT changes), so the attempt suffix lets a re-run pass supersede the original failure in the digest instead of being dropped as a duplicate of the same run.



20
21
22
23
24
25
# File 'lib/chat_notifier/test_environment/github.rb', line 20

def run_key
  attempt = settings.fetch("GITHUB_RUN_ATTEMPT", nil)
  return run_id unless run_id && attempt

  "#{run_id}.#{attempt}"
end

#test_run_urlObject



6
7
8
# File 'lib/chat_notifier/test_environment/github.rb', line 6

def test_run_url
  "#{url}/actions/runs/#{run_id}"
end