Skip to content

Have actions *not* run a job if a label is set #26712

Answered by mathomp4
mathomp4 asked this question in Actions
Discussion options

You must be logged in to vote

Sigh. I might have figured this out. I actually decided to read the documentation carefully and:

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.

After staring at the GitHub API docs, labels is an array, which means contains seems to be looking for a “full string” (as it were) not just something in the string. Thus:

    if: "!contains(github.event.pull_request.labels.*.name, '0 diff trivial')"

seems more correct.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
1 reply
@rffontenelle
Comment options

Comment options

You must be logged in to vote
1 reply
@DanyC97
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants