trigger_build action will trigger your repository's pipeline. You can control what workflow is executed by passing in parameters, then using those parameters to filter workflows.
For more information about how to declare parameters and filter workflows in CircleCI, see the CircleCI documentation.
This example triggers a deployment in CircleCI when code is deployed to the "Staging" environment for more than 4 hours and is healthy:
rules:- run-deploy:conditions:- environment='Staging'- deployed_for>'4h'- health='Healthy'actions:- trigger_build:parameters:run_deploy: trueenvironment: production
It passes several parameters to be used by CircleCI:
This is an example of the CircleCI configuration that uses the
run_deploy parameter to selectively execute a workflow, while the
environment parameter is used within the job to perform the deployment:
parameters:run_deploy:default: falsetype: booleanenvironment:type: stringdefault: stagingjobs:run-deploy:docker:- image: circleci/python:3.8.6steps:- run:command: |echo "Deploying to <<pipeline.parameters.environment>>"workflows:deploy:when: << pipeline.parameters.run_deploy >>jobs:- run-deploy