> 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

Get setup instructions for automated and manually specified targets. Learn how to manually define targets based on your directory structure in our guide.

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.


---

# 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://docs.aviator.co/mergequeue/concepts/affected-targets/directory-based-affected-targets.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.
