GitHub/Actions: Difference between revisions

From Omnia
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
== Runner ==
actions/checkout: Action for checking out a repo - https://github.com/actions/checkout
actions/checkout: Action for checking out a repo - https://github.com/actions/checkout


Line 23: Line 25:
tar xzf ./actions-runner-linux-arm-2.304.0.tar.gz
tar xzf ./actions-runner-linux-arm-2.304.0.tar.gz
</pre>
</pre>
== Action Expressions ==
https://docs.github.com/en/actions/learn-github-actions/expressions
== String Operations ==
Reference: https://docs.github.com/en/actions/learn-github-actions/expressions#functions
Convert json string to json:
fromJSON(string)
Pretty print json value:
toJSON(string)
Join - The value for array can be an array or a string. All values in array are concatenated into a string.
join( array, optionalSeparator )
Format - Replaces values in the string, with the variable replaceValueN.
format( string, replaceValue0, replaceValue1, ..., replaceValueN)
format('{0}/{1}', val1, val2)
Also useful for concating two strings:
format('{0}{1}', str1, str2)
Ends With -
endsWith( searchString, searchValue )
startsWith( searchString, searchValue )
contains( search, item )
eg. contains('Hello world', 'llo')

Revision as of 19:01, 25 July 2024

Runner

actions/checkout: Action for checking out a repo - https://github.com/actions/checkout


Releases · actions/runner - https://github.com/actions/runner/releases

Linux x64:

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -O -L https://github.com/actions/runner/releases/download/v2.304.0/actions-runner-linux-x64-2.304.0.tar.gz
# Extract the installer
tar xzf ./actions-runner-linux-x64-2.304.0.tar.gz

ARM:

# Create a folder
mkdir actions-runner && cd actions-runner
# Download the latest runner package
curl -O -L https://github.com/actions/runner/releases/download/v2.304.0/actions-runner-linux-arm-2.304.0.tar.gz
# Extract the installer
tar xzf ./actions-runner-linux-arm-2.304.0.tar.gz

Action Expressions

https://docs.github.com/en/actions/learn-github-actions/expressions

String Operations

Reference: https://docs.github.com/en/actions/learn-github-actions/expressions#functions

Convert json string to json:

fromJSON(string)

Pretty print json value:

toJSON(string)

Join - The value for array can be an array or a string. All values in array are concatenated into a string.

join( array, optionalSeparator )

Format - Replaces values in the string, with the variable replaceValueN.

format( string, replaceValue0, replaceValue1, ..., replaceValueN)
format('{0}/{1}', val1, val2)
Also useful for concating two strings:
format('{0}{1}', str1, str2)

Ends With -

endsWith( searchString, searchValue )
startsWith( searchString, searchValue )
contains( search, item )
eg. contains('Hello world', 'llo')