Skip to content

How to write multi-line condition in if #25641

Answered by BrightRan
kei-yamazaki asked this question in Actions
Discussion options

You must be logged in to vote

@kei-yamazaki,

you need to use the symbol ‘|’ to set the multi-line condition.
For example:

jobs:
  job1:
    if: |
      github.event_name == 'push' ||
      (github.event_name == 'pull_request' && github.head_ref == 'master')

Here is a same topic as reference:

<a href="https://github.community/t/github-action-combining-if-condition-or-writing-it-in-multiple-lines/116903/2">Github action combining if condition or writing it in Multiple lines</a> <a class="badge-wrapper  bullet" href="/c/code-to-cloud/github-actions/41"><span class="badge-category-parent-bg" style="background-color: #6a737d;"></span><span class="badge-category-bg" style="background-color: #2188ff;"></span><span style="…

Replies: 6 comments 3 replies

Comment options

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

Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

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

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