Module: GitHub::Actions Private
- Defined in:
- utils/github/actions.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. 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
Class Method Details
.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.
13 14 15 16 17 18 |
# File 'utils/github/actions.rb', line 13 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 |
.format_multiline_string(name, value) ⇒ 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.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'utils/github/actions.rb', line 21 def self.format_multiline_string(name, value) # Format multiline strings for environment files # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings delimiter = "ghadelimiter_#{SecureRandom.uuid}" if name.include?(delimiter) || value.include?(delimiter) raise "`name` and `value` must not contain the delimiter" end <<~EOS #{name}<<#{delimiter} #{value} #{delimiter} EOS end |