Class: GithubActions::Job
- Inherits:
-
Object
- Object
- GithubActions::Job
- Defined in:
- lib/tasks/github_actions/github_actions/job.rb
Overview
Github Actions job
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#matrix ⇒ Object
readonly
Returns the value of attribute matrix.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#runs_on ⇒ Object
readonly
Returns the value of attribute runs_on.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#workflow ⇒ Object
readonly
Returns the value of attribute workflow.
Instance Method Summary collapse
-
#initialize(name, data, workflow) ⇒ Job
constructor
A new instance of Job.
-
#unsupported_steps ⇒ Array<String>
check if the defined steps can be used locally.
Constructor Details
#initialize(name, data, workflow) ⇒ Job
Returns a new instance of Job.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 30 def initialize(name, data, workflow) @name = name @runs_on = data["runs-on"] @container = data["container"] @workflow = workflow @matrix = data.fetch("strategy", {})["matrix"] @steps = data["steps"].map do |step| Step.new(self, step) end end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def container @container end |
#matrix ⇒ Object (readonly)
Returns the value of attribute matrix.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def matrix @matrix end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def name @name end |
#runs_on ⇒ Object (readonly)
Returns the value of attribute runs_on.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def runs_on @runs_on end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def steps @steps end |
#workflow ⇒ Object (readonly)
Returns the value of attribute workflow.
25 26 27 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 25 def workflow @workflow end |
Instance Method Details
#unsupported_steps ⇒ Array<String>
check if the defined steps can be used locally
45 46 47 48 49 |
# File 'lib/tasks/github_actions/github_actions/job.rb', line 45 def unsupported_steps steps.each_with_object([]) do |step, array| array << step.name unless step.supported? end end |