Using git commit message as a condition

Hey,
So I have an expansive test that I don’t want to run on every commit in my circle ci workflow.
I found that I can use ‘[ci stop]’ in my commit message but it stops the whole workflow. And I want to skip only one step/job (not sure what is what, I’m a confused frontend dev lol).

Here is a mock config.yml for an example to be clear.


notExpansiveTest:
    <<: *notExpansiveTest
    steps:
      - checkout
      - run:
          name: notExpansiveTest
          command: |
            npm install notExpansiveTest     
           npm run notExpansiveTest

notExpansiveTest:
    <<: *notExpansiveTest
    steps:
      - checkout
      - run:
          name: notExpansiveTest
          command: |
            npm install notExpansiveTest     
           npm run notExpansiveTest

myExpensiveTest:
    environment:
      ExpensiveTest: /tmp/ExpensiveTest-test-results
    docker:
      - image: ExpensiveTest/docker-cli
    
    - when:
        condition: << git.commit.includes(' --runExpensiveTest ') >>
        steps:
          - run: ....
          - run: e.....params.json
          - run: .............

So what I want is- the first two steps to run on every commit no matter what is the message.
And the last (expansive) test to run only when the commit looks like this: “–runExpansiveTest fixed some issue”

Thank you for the help.

I’m not sure that the circleci system provides the git commit text as a parameter, so you may need to look at this solution

Thanks (:slight_smile:
I solved my problem with this: (not commit message but good enough for me)

- hold: # <<< Stop the workflow to not run an expansive test on each run.
          type: approval 
          requires: # We only run the "hold" job when not-expansive-test has succeeded
           - not-expansive-test
      # On approval of the `hold` job, an expansive test will run.

      - expansive-test:
          requires:
            - hold
            - not-expansive-test