Class: GithubActions::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/github_actions/github_actions/step.rb

Overview

Github Actions step

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, step) ⇒ Step

constructor

Parameters:

  • job (GithubActions::Job)

    the parent job

  • step (Hash)

    the step definition from the YAML file



30
31
32
33
34
35
36
# File 'lib/tasks/github_actions/github_actions/step.rb', line 30

def initialize(job, step)
  @job = job
  @name = step["name"]
  @uses = step["uses"]
  @run = step["run"]
  @env = step["env"]
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



25
26
27
# File 'lib/tasks/github_actions/github_actions/step.rb', line 25

def env
  @env
end

#jobObject (readonly)

Returns the value of attribute job.



25
26
27
# File 'lib/tasks/github_actions/github_actions/step.rb', line 25

def job
  @job
end

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/tasks/github_actions/github_actions/step.rb', line 25

def name
  @name
end

#runObject (readonly)

Returns the value of attribute run.



25
26
27
# File 'lib/tasks/github_actions/github_actions/step.rb', line 25

def run
  @run
end

#usesObject (readonly)

Returns the value of attribute uses.



25
26
27
# File 'lib/tasks/github_actions/github_actions/step.rb', line 25

def uses
  @uses
end

Instance Method Details

#supported?Boolean

we can run the step if it is just a plain command (not a Javascript or Docker container action) and the environment variables do not contain any expansions (usually used for Github secrets)

Returns:

  • (Boolean)

    ‘true` if the step is supported, `false` otherwise



42
43
44
# File 'lib/tasks/github_actions/github_actions/step.rb', line 42

def supported?
  known_uses? && !expansion?
end