Module: GitHub::Actions
- Defined in:
- utils/github/actions.rb
Overview
This module is part of an internal API. This module may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper functions for interacting with GitHub Actions.
Defined Under Namespace
Classes: Annotation
Class Method Summary collapse
- .env_set? ⇒ Boolean private
- .escape(string) ⇒ String private
- .puts_annotation_if_env_set!(type, message, file: nil, line: nil) ⇒ Boolean private
Class Method Details
.env_set? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
18 19 20 |
# File 'utils/github/actions.rb', line 18 def self.env_set? ENV.fetch("GITHUB_ACTIONS", false).present? end |
.escape(string) ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 11 12 13 14 15 |
# File 'utils/github/actions.rb', line 10 def self.escape(string) # See https://github.community/t/set-output-truncates-multiline-strings/16852/3. string.gsub("%", "%25") .gsub("\n", "%0A") .gsub("\r", "%0D") end |
.puts_annotation_if_env_set!(type, message, file: nil, line: nil) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
29 30 31 32 33 34 35 36 37 38 |
# File 'utils/github/actions.rb', line 29 def self.puts_annotation_if_env_set!(type, , file: nil, line: nil) # Don't print annotations during tests, too messy to handle these. return false if ENV.fetch("HOMEBREW_TESTS", false) return false unless env_set? std = (type == :notice) ? $stdout : $stderr std.puts Annotation.new(type, ) true end |