Class: KnapsackPro::Config::CI::GithubActions
- Defined in:
- lib/knapsack_pro/config/ci/github_actions.rb
Instance Method Summary collapse
- #branch ⇒ 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
- #user_seat ⇒ Object
Instance Method Details
#branch ⇒ Object
31 32 33 34 35 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 31 def branch # GITHUB_REF - The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. # If neither a branch or tag is available for the event type, the variable will not exist. ENV['GITHUB_REF'] || ENV['GITHUB_SHA'] end |
#commit_hash ⇒ Object
27 28 29 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 27 def commit_hash ENV['GITHUB_SHA'] end |
#detected ⇒ Object
45 46 47 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 45 def detected ENV.key?('GITHUB_ACTIONS') ? self.class : nil end |
#fixed_queue_split ⇒ Object
49 50 51 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 49 def fixed_queue_split true end |
#node_build_id ⇒ Object
14 15 16 17 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 14 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
10 11 12 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 10 def node_index # not provided end |
#node_retry_count ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 19 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
6 7 8 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 6 def node_total # not provided end |
#project_dir ⇒ Object
37 38 39 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 37 def project_dir ENV['GITHUB_WORKSPACE'] end |
#user_seat ⇒ Object
41 42 43 |
# File 'lib/knapsack_pro/config/ci/github_actions.rb', line 41 def user_seat ENV['GITHUB_ACTOR'] end |