class GithubActions::Workflow
Github Actions workflow @see docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
Attributes
file[R]
jobs[R]
name[R]
on[R]
Public Class Methods
new(file)
click to toggle source
load the workflow from an YAML file @param file [String] path to the YAML file
# File lib/tasks/github_actions/github_actions/workflow.rb, line 39 def initialize(file) @file = file yml = YAML.load_file(file) @name = yml["name"] # "on" is autoconverted to Boolean "true" for this line # on: [push, pull_request] # see https://medium.com/@lefloh/lessons-learned-about-yaml-and-norway-13ba26df680 @on = yml[true] @jobs = yml["jobs"].map do |name, job| Job.new(name, job, self) end end
read()
click to toggle source
load all defined workflows from all YAML files @return [Array<GithubActions::Workflow>]
# File lib/tasks/github_actions/github_actions/workflow.rb, line 31 def self.read Dir[".github/workflows/*.{yml,yaml}"].map do |file| new(file) end end