class GithubActions::Step

Github Actions step @see docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

Attributes

env[R]
job[R]
name[R]
run[R]
uses[R]

Public Class Methods

new(job, step) click to toggle source

constructor @param job [GithubActions::Job] the parent job @param step [Hash] the step definition from the YAML file

# 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

Public Instance Methods

supported?() click to toggle source

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) @return [Boolean] ‘true` if the step is supported, `false` otherwise

# File lib/tasks/github_actions/github_actions/step.rb, line 42
def supported?
  known_uses? && !expansion?
end

Private Instance Methods

expansion?() click to toggle source

we cannot expand the Github secrets @return [Boolean] ‘true` if an expansion is found, `false` otherwise

# File lib/tasks/github_actions/github_actions/step.rb, line 56
def expansion?
  env&.any? { |_k, v| v.to_s.include?("${{") }
end
known_uses?() click to toggle source

Javascript or Docker actions are not supported @return [Boolean] ‘true` if there is a workaround defined for the step

# File lib/tasks/github_actions/github_actions/step.rb, line 50
def known_uses?
  uses.nil? || uses.match?(CHECKOUT_ACTION) || uses.match?(COVERALLS_ACTION)
end