---
title: Assign
description: Assign a pull request to a user.
---

The `assign` action allows you to assign one or more users to a pull request
when the conditions you specify are met. This can help automate the process of
designating the right people to handle specific pull requests, based on your
conditions.

## Parameters

| Key name | Value type | Description |
| --- | --- | --- |
| `add_users` | list of simple-template |  |
| `remove_users` | list of simple-template |  |
| `users` | list of simple-template |  |

Each entry in `users`, `add_users` or `remove_users` is a
[`User`](/configuration/data-types#user): a GitHub login, or the `{{ author }}`
variable to assign the pull request to its author. `users` is the older form of
`add_users` and behaves the same way; prefer `add_users` in new rules.

:::caution
  GitHub silently ignores a login it will not accept as an assignee, such as a
  user with no access to the repository, and still answers the request as a
  success. Mergify has no failure to report, so the action succeeds and the pull
  request ends up without that assignee. Check that the logins you list have
  access to the repository.
:::

When GitHub rejects the assignment request outright rather than ignoring a
login, Mergify reports the GitHub error on the rule's check run instead of a
success.

Mergify skips any login ending in `[bot]` when adding assignees, so a rule that
assigns `{{ author }}` does nothing on a pull request opened by a bot. A login
that appears in both `add_users` and `remove_users` cancels out: Mergify neither
adds nor removes it.

GitHub allows at most 10 assignees on a pull request, so `users` and `add_users`
accept up to 10 entries each. `remove_users` accepts up to 40.

## Examples

### Assign Defined User

Below is an example of how to use the `assign` action:

```yaml
pull_request_rules:
  - name: assign PR to a user
    conditions:
      - "#files = 1"
    actions:
      assign:
        add_users:
          - "username1"
          - "username2"
```

### Assign Pull Request Author User

Below is an example of how to use the `assign` action to assign a pull request
to its author:

```yaml
pull_request_rules:
  - name: assign PR to its author
    conditions:
      - "#files = 1"
    actions:
      assign:
        add_users:
          - "{{ author }}"
```
