> For the complete documentation index, see [llms.txt](https://help.sleuth.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sleuth.io/sleuth-dora/sleuth-automations/actions/trigger_build/trigger-build-circleci.md).

# CircleCI

## Usage

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: true
              environment: production
```

It passes several parameters to be used by CircleCI: `run_deploy` and `environment`. For more information about how to declare parameters and filter workflows in CircleCI, see the [CircleCI documentation](https://circleci.com/docs/2.0/pipeline-variables/#pipeline-parameters-in-configuration).

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: false
    type: boolean
  environment:
    type: string
    default: staging

jobs:
  run-deploy:
    docker:
      - image: circleci/python:3.8.6
    steps:
      - run:
          command: |
            echo "Deploying to <<pipeline.parameters.environment>>"


workflows:
  deploy:
    when: << pipeline.parameters.run_deploy >>
    jobs:
      - run-deploy
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.sleuth.io/sleuth-dora/sleuth-automations/actions/trigger_build/trigger-build-circleci.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
