Conditional to check if a string is included in a list?

Viewed 4838
2 Answers

The closest one you can use is

${{ contains(github.event.action, 'foo') || contains(github.event.action, 'bar') }}

Documentation

contains( search, item )

Returns true if search contains item. If search is an array, this function returns true if the item is an element in the array. If search is a string, this function returns true if the item is a substring of search. This function is not case sensitive. Casts values to a string.

Example using an array contains(github.event.actions, 'bug')

Example using a string contains('Hello world', 'llo') returns true

Reference: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#contains

Related