Class: Libconsole::CI::Github::Attr

Inherits:
Object
  • Object
show all
Defined in:
lib/libconsole/ci/github.rb

Overview

github.com/actions/toolkit/blob/main/packages/core/__tests__/core.test.ts github attr_accessor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttr

Returns a new instance of Attr.



83
84
85
86
87
88
89
90
91
# File 'lib/libconsole/ci/github.rb', line 83

def initialize
  @github_path = ENV["GITHUB_PATH"] || ""
  @github_env = ENV["GITHUB_ENV"] ? ENV["GITHUB_ENV"] + "\n" : ""
  @github_step_summary = ENV["GITHUB_STEP_SUMMARY"]
  @github_state = ENV["GITHUB_STATE"]
  @github_output = ENV["GITHUB_OUTPUT"]

  @runner_debug = ENV["RUNNER_DEBUG"]
end

Instance Attribute Details

#github_envObject

Returns the value of attribute github_env.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def github_env
  @github_env
end

#github_outputObject Also known as: output

Returns the value of attribute github_output.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def github_output
  @github_output
end

#github_pathObject

Returns the value of attribute github_path.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def github_path
  @github_path
end

#github_stateObject Also known as: state

Returns the value of attribute github_state.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def github_state
  @github_state
end

#github_step_summaryObject Also known as: summary

Returns the value of attribute github_step_summary.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def github_step_summary
  @github_step_summary
end

#runner_debugObject

Returns the value of attribute runner_debug.



74
75
76
# File 'lib/libconsole/ci/github.rb', line 74

def runner_debug
  @runner_debug
end

Instance Method Details

#add_path(path) ⇒ Object



93
94
95
# File 'lib/libconsole/ci/github.rb', line 93

def add_path(path)
  @github_path = _path_arr(@github_path).push(path).join(":")
end

#debug?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/libconsole/ci/github.rb', line 123

def debug?
  @runner_debug
end

#export_variable(key, val) ⇒ Object



97
98
99
# File 'lib/libconsole/ci/github.rb', line 97

def export_variable(key, val)
  @github_env += "#{key}=#{val}\n"
end

#input_(*argv) ⇒ Object



101
102
103
104
105
106
107
108
109
110
# File 'lib/libconsole/ci/github.rb', line 101

def input_(*argv)
  name = argv[0]
  val = argv[1]
  case argv.size
  when 1
    ENV["INPUT_#{name}"]
  when 2
    ENV["INPUT_#{name}"] = val
  end
end

#state_(*argv) ⇒ Object



112
113
114
115
116
117
118
119
120
121
# File 'lib/libconsole/ci/github.rb', line 112

def state_(*argv)
  name = argv[0]
  val = argv[1]
  case argv.size
  when 1
    ENV["STATE_#{name}"]
  when 2
    ENV["STATE_#{name}"] = val
  end
end