> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# selectiveci/setup-selective

Intelligent test runner that balances work across nodes, but doesn't stop there. Get real-time test results, intelligent ordering, flake detection, and more.


## Commands

### init

This command sets required environment variables for Selective CI.
The values are typically set to CircleCI pipeline variables. See the example above.
Other pipeline variables are documented here: https://circleci.com/docs/variables/#pipeline-values


| Parameter | Type | Default | Description |
|---|---|---|---|
| `actor` | string |  | The author of the commit that triggered the build. |
| `run_id` | string |  | This should always be set to |
| `target_branch` | string | main | The branch used for creating a diff. |

## Examples

### example

This sample configuration assumes you're using Github.
Other pipeline variables are documented here: https://circleci.com/docs/variables/#pipeline-values


```yaml
version: '2.1'
orbs:
  setup-selective: selectiveci/setup-selective@0.1.1
jobs:
  test:
    docker:
      - image: cimg/ruby:3.2
    steps:
      - checkout
      - setup-selective/init:
          actor: << pipeline.trigger_parameters.github_app.user_username >>
          run_id: << pipeline.id >>
          target_branch: main
      - run: bundle install
      - run: bundle exec selective rspec
workflows:
  test:
    jobs:
      - test
```