jmarx
1
Is there any way to run single command like this:
run:
name: Version Check
command: echo "do something"
if branch !== ‘main’
I know you can do this
filters:
branches:
ignore: main
But I’m wondering if that filter can be applied to a single command rather than the entire workflow.
Hi @jmarx ,
The syntax will be different than when applying a filter for a job, but it is possible to set conditional steps using the when
key.
Here are some pages in our documentation/knowledge base regarding conditional steps:
https://circleci.com/docs/2.0/configuration-reference/#the-when-step-requires-version-21
https://support.circleci.com/hc/en-us/articles/360043638052-Conditional-steps-in-jobs-and-conditional-workflows
I believe for your use case, you can use a combination of not
and equals
, and pass in the branch name main
.
Please have a look at the above pages, and let us know if you have any additional questions!