> For the complete documentation index, see [llms.txt](https://docs.aviator.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aviator.co/mergequeue/concepts/affected-targets/directory-based-affected-targets.md).

# Directory-Based Affected Targets

If you don't use Bazel like systems to auto-generate the affected targets, you can instead manually define targets based on your directory structure. There are two ways to do it.

### Automated (preferred)

A GitHub action can be created to automatically assign affected targets to reach PR.

```yaml
name: Aviator Queue PR
on:
  pull_request:
    types: [ labeled ]
jobs:
  path_board:
    if: ${{ github.event.label.name == 'av-ready' }}
    runs-on: ubuntu-latest
    steps:
    - uses: dorny/paths-filter@v2
      id: filter
      with:
        filters: |
          workflows:
            - '.github/workflows/*'
          billing:
            - billing/.*
          tests:
            - tests/*
          other:
            - *.txt
    - run: |
        TARGETS=${{ toJSON(steps.filter.outputs.changes) }}
        PR_NUMBER=${{ github.event.number }}
        curl -X POST -H "Authorization: Bearer ${{ secrets.AVIATOR_API_KEY }}" \
          -H "Content-Type: application/json" \
          -d '{
          "action": "queue",
          "pull_request": {
              "number": '"$PR_NUMBER"',
              "repository": {"name": "testrepo", "org": "ankitjaindce"},
              "affected_targets": '"$TARGETS"'
          }
        }' https://api.aviator.co/api/v1/pull_request/
```

A few things to note:

* We use [<mark style="color:blue;">path-filters action</mark>](https://github.com/dorny/paths-filter) to capture all the file path changes in the given PR.
* You may also want to store the API access token as `AVIATOR_API_KEY` in [<mark style="color:blue;">GitHub secrets.</mark>](https://docs.github.com/en/actions/security-guides/encrypted-secrets) or replace the secrets above
* `filters` are the various directory packages that you can define as various affected targets. It accepts glob format and you can define more than 1 path per affected target. You may also optionally specify this in a separate file. Read more on the path-filters action [<mark style="color:blue;">documentation</mark>](https://github.com/dorny/paths-filter).
* This will queue the PR in Aviator. You can also want to setup a similar GH action to dequeue when the label is removed.
* This label `av-ready` should be separate from the label defined in Aviator’s configuration.

### Manually specify targets

If you prefer to do this manually, you can also specify the affected targets as a Slash command comment in your PR. The targets can be represented as a comma separated list in the `/aviator merge` command:

```
/aviator merge --targets=frontend,api,android
```

Although Manual approach is much simpler, it is prone to human errors and is a less preferred approach.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.aviator.co/mergequeue/concepts/affected-targets/directory-based-affected-targets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
