Class: KnapsackPro::Config::CI::GithubActions
- Defined in:
- lib/knapsack_pro/config/ci/github_actions.rb
Instance Method Summary collapse
- #branch ⇒ Object
- #ci_provider ⇒ Object
- #commit_hash ⇒ Object
- #detected ⇒ Object
- #fixed_queue_split ⇒ Object
- #node_build_id ⇒ Object
- #node_index ⇒ Object
- #node_retry_count ⇒ Object
- #node_total ⇒ Object
- #project_dir ⇒ Object
- #test_queue_id ⇒ Object
- #user_seat ⇒ Object
Instance Method Details
#branch ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 33 def branch # `on: push` has `GITHUB_HEAD_REF=` head_ref = ENV.fetch('GITHUB_HEAD_REF', '') return head_ref unless head_ref == '' ENV['GITHUB_REF_NAME'] || ENV['GITHUB_SHA'] end |
#ci_provider ⇒ Object
57 58 59 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 57 def ci_provider "GitHub Actions" end |
#commit_hash ⇒ Object
29 30 31 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 29 def commit_hash ENV['GITHUB_SHA'] end |
#detected ⇒ Object
49 50 51 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 49 def detected ENV.key?('GITHUB_ACTIONS') ? self.class : nil end |
#fixed_queue_split ⇒ Object
53 54 55 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 53 def fixed_queue_split true end |
#node_build_id ⇒ Object
16 17 18 19 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 16 def node_build_id # A unique number for each run within a repository. This number does not change if you re-run the workflow run. ENV['GITHUB_RUN_ID'] end |
#node_index ⇒ Object
12 13 14 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 12 def node_index # not provided end |
#node_retry_count ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 21 def node_retry_count # A unique number for each attempt of a particular workflow run in a repository. # This number begins at 1 for the workflow run's first attempt, and increments with each re-run. run_attempt = ENV['GITHUB_RUN_ATTEMPT'] return unless run_attempt run_attempt.to_i - 1 end |
#node_total ⇒ Object
8 9 10 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 8 def node_total # not provided end |
#project_dir ⇒ Object
41 42 43 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 41 def project_dir ENV['GITHUB_WORKSPACE'] end |
#test_queue_id ⇒ Object
61 62 63 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 61 def test_queue_id node_build_id end |
#user_seat ⇒ Object
45 46 47 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 45 def user_seat ENV['GITHUB_ACTOR'] end |