Skip to main content

Check trigger source for API

Overview

This guide is on how to use conditional workflows to check when the trigger_source was the API used as a trigger.

Workflow example

The following code can be used:

workflows:
  theworkflow:
    when:
      - equal: [ api, << pipeline.trigger_source >> ]
    jobs:
      - myjob

This uses logic statements to check the trigger_source pipeline parameter against the api string The documentation for pipeline parameters can be found here.

Please note: The "Trigger Pipeline" button uses the API to trigger it. Please be aware that because of that design, it's impossible to differentiate between starting a workflow using an API and using the button.

Did this answer your question?