---
title: Configuration Data Types
description: The different data types you can find in Mergify configuration file
---

When using templates or conditions, data comes in different types. The data
types available in the Mergify configuration file are listed below.

## Commit

A commit is an object that embeds information about a [Git
commit](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits)

| Key name | Value type | Description |
| --- | --- | --- |
| `author` | string or null | Name of the author |
| `commit_message` | string |  |
| `commit_verification_verified` | boolean | Indicates if the commit has been marked as verified by GitHub |
| `committer` | string or null | Name of the committer |
| `date_author` | string or null |  |
| `date_committer` | string or null |  |
| `email_author` | string or null |  |
| `email_committer` | string or null |  |
| `gh_author_login` | string or null | GitHub login of the author |
| `parents` | list of string |  |
| `sha` | string |  |

In a condition, a commit is addressed as `commits[<index>].<sub-attribute>`,
where the index is a position (`0` is the first commit, `-1` the last) or `*`
for any commit:

```yaml
pull_request_rules:
  - name: check that commits are not too old
    conditions:
       - commits[*].date_committer < 365 days ago
    actions:
      comment:
        message: One of the commit is too old!
```

Only a subset of the fields above can be used as a sub-attribute:
`author`, `committer`, `commit_message`, `commit_verification_verified`,
`date_author`, `date_committer`, `email_author` and `email_committer`. Any
other field is rejected when the configuration is validated.

## Commit author

| Key name | Value type | Description |
| --- | --- | --- |
| `email` | string or null | Email address of the author |
| `name` | string or null | Name of the author |

## Globs

Glob patterns are used by the `*=` operator in your
[conditions](/configuration/conditions), by
[file-pattern scopes](/merge-queue/scopes/file-patterns), and by
[`barrier_files`](/merge-queue/scopes#declaring-a-pull-request-impacts-every-scope).

{/* eslint-disable */}
| Pattern            | Description |
|--------------------|-------------|
| `**` (entire segment) | Matches any number of file or directory segments, including zero. |
| `*` (entire segment)  | Matches one file or directory segment. |
| `*` (part of a segment) | Matches any number of non-separator characters, including zero. |
| `?` | Matches one non-separator character. |
| `[seq]` | Matches one character in `seq`, where `seq` is a sequence of characters. Range expressions are supported; e.g., `[a-z]` matches any lowercase ASCII letter. Multiple ranges can be combined, e.g. `[a-zA-Z0-9_]` matches any ASCII letter, digit, or underscore. |
| `[!seq]` | Matches one character **not** in `seq`, where `seq` follows the same rules as above. |
| `{a,b}` | Matches either `a` or `b`. See [brace alternation](#brace-alternation). |
{/* eslint-enable */}

:::note
For a literal match, wrap the meta-characters in brackets. For example, `[?]` matches the character `?`.
:::

The `**` wildcard enables recursive globbing. A few examples:

| Pattern | Meaning |
|----------|----------|
| `**/*` | Any path with at least one segment. |
| `**/*.py` | Any path with a final segment ending in `.py`. |
| `assets/**` | Any path starting with `assets/`. |
| `assets/**/*` | Any path starting with `assets/`, excluding `assets/` itself. |

### Brace alternation

A brace group matches any one of its comma-separated branches. Mergify expands
the group into one pattern per branch, so `**/*.{js,ts}` is equivalent to
listing `**/*.js` and `**/*.ts` separately:

```yaml
pull_request_rules:
  - name: label frontend changes
    conditions:
      - files *= web/**/*.{js,jsx,ts,tsx}
    actions:
      label:
        add:
          - frontend
```

A pattern can contain several groups, and groups can nest. `{a,b{c,d}}` matches
`a`, `bc` and `bd`, and `{src,tests}/**/*.{py,pyi}` covers the four
combinations of directory and extension.

:::caution
  An empty branch is dropped rather than matching nothing, so `foo{,.txt}`
  matches `foo.txt` but **not** `foo`. List the two patterns separately when you
  need both.
:::

An unbalanced `{` or `}` is a configuration error, not a literal brace. Mergify
rejects the configuration instead of leaving you with a pattern that silently
matches nothing. To match a brace as a character, escape it as `\{` or `\}`, or
bracket it as `[{]` or `[}]`; a literal comma inside a group is `\,`.

A pattern may expand to at most 128 alternatives and nest at most 32 levels
deep. Beyond either limit, Mergify rejects the configuration.

:::note
  YAML reads `{` at the start of a value as the beginning of a mapping, so quote
  a pattern that starts with a brace: `'{src,tests}/**'`. Backslash escapes need
  single quotes or no quotes at all, since a double-quoted YAML string treats
  `\{` as an invalid escape.
:::

## Regular expressions

{/* fix links to "Operators" */}

You can use regular expressions with matching operators in your [conditions](/configuration/conditions).

Mergify uses [Python regular expressions](https://docs.python.org/3/library/re.html)
to match rules.

:::note
You can use [regex101](https://regex101.com),
[PyRegex](http://www.pyregex.com), or [Pythex](https://pythex.org) to test your
regular expressions.
:::

```yaml
pull_request_rules:
  - name: add python label if a Python file is modified
    conditions:
      - files ~= \.py$
    actions:
      label:
        add:
          - python

  - name: automatic merge for main when the title does not contain “WIP” (ignoring case)
    conditions:
      - base = main
      - -title ~= (?i)wip
    actions:
      merge:
        method: merge
```

## Schedule

This format represents a schedule. It can contain only days, only times or
both and can have a timezone specified with the times (for the list of
available time zones, see the [IANA
format](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)). If no
timezone is specified, it defaults to UTC.

:::caution
Schedule can be only used with the equality operators `=` and `!=`.
:::

```text
schedule = Mon-Fri
schedule = 09:00-19:00
schedule = 09:00-19:00[America/Vancouver]
schedule != Mon-Fri 09:00-19:00[America/Vancouver]
schedule != SAT-SUN
```

A time range runs from its start to its end inside one day, and Mergify rejects
a configuration whose start is not before its end: `09:00-19:00` is accepted,
while `22:00-02:00` and `09:00-09:00` are not. Express an overnight window as
two schedules joined with
[`or`](/configuration/conditions#combining-conditions-using-logical-operators),
split at midnight into `22:00-23:59` and `00:00-02:00`. When the schedule names
days as well, the half after midnight falls on the following day, so
`Mon-Fri 22:00-23:59` pairs with `Tue-Sat 00:00-02:00`.

Both bounds are minute-precise and inclusive, so `09:00-19:00` is still
satisfied at 19:00 and stops being satisfied at 19:01. A range carries at most
one timezone, written on the end time, and that timezone applies to both
bounds.

In a queue rule's `merge_conditions`, a schedule keeps pull requests from
merging outside its window, and the merge queue tests them ahead of it. See
[Merge Schedules](/merge-queue/merge-schedules).

## Timestamp

The timestamp format must follow the [ISO 8601
standard](https://en.wikipedia.org/wiki/ISO_8601). If the timezone is missing,
the timestamp is assumed to be in UTC. The supported timezones come from the
[IANA database](https://www.iana.org/time-zones).

:::caution
  The timestamp attributes (`created-at`, `updated-at`, `closed-at`,
  `merged-at`, `queued-at` and `queue-merge-started-at`) support only the
  ordering operators `>=`, `<=`, `<` and `>`. `current-datetime` also accepts
  `=` and `!=`, which compare it against a
  [timestamp interval](#timestamp-interval). None of them can be negated with
  the `-` prefix.
:::

Supported formats:

```text
2021-04-05
2012-09-17T22:02:51
2008-09-22T14:01:54Z
2013-12-05T07:19:04-08:00
2013-12-05T07:19:04[Europe/Paris]
```

```yaml
- name: end of life version 10.0
  conditions:
    - base = stable/10.0
    - updated-at <= 2021-04-05
  actions:
    comment:
      message: |
        The pull request needs to be rebased after end of life of version 10.0
```

## Timestamp interval

Mergify supports [ISO8601 time
intervals](https://en.wikipedia.org/wiki/ISO_8601#Time_intervals) for some of
the exposed attributes.

If the timezone is missing, the timestamp is assumed to be in UTC. The
supported timezones come from the [IANA
database](https://www.iana.org/time-zones).

```text
2023-07-13T14:00/2023-07-13T16:00
2023-07-13T14:00:00.123/2023-07-13T16:00:00.123
2023-07-13T14:00Z/2023-07-13T16:00Z
2023-07-13T14:00/2023-07-13T16:00[Europe/Paris]
```

```yaml
- name: merge except on new year day
  conditions:
    - current-datetime != 2023-01-01T00:00/2023-01-01T23:59[Europe/Paris]
  actions:
    merge:
```

Unspecified digits can also be used for some part of the timestamp:

```text
# 14:00 to 19:00 the 14th of July of every year
XXXX-07-14T14:00/XXXX-07-14T19:00[Europe/Paris]

# 14:00 to 19:00 every day of July of every year
XXXX-07-XXT14:00/XXXX-07-XXT19:00[Europe/Paris]

# 14:00 to 19:00 every day of July of 2023
2023-07-XXT14:00/2023-07-XXT19:00[Europe/Paris]

# 14:00 to 19:00 every 31st day of every month of 2023
# If a month doesn't have a 31st day it will be skipped
2023-XX-31T14:00/2023-XX-31T19:00[Europe/Paris]

# 14:00 to 19:00 every 31st day of every month of every year
XXXX-XX-31T14:00/XXXX-XX-31T19:00[Europe/Paris]
```

Both ends of the interval have to leave the same digits unspecified. Mergify
rejects a configuration where only one end leaves the year unspecified, because
that end would take whatever year it is evaluated against, and the interval
would match a much wider range than it appears to.

## Relative timestamp

Timestamps can be expressed relative to the current date and time. The format
is `[DD days] [HH hours] [MM minutes] ago`:

- `DD`, the number of days
- `HH`, the number of hours
- `MM`, the number of minutes

The offset is subtracted from the current time rather than rounded down to a
whole day: evaluated at 14:30 UTC on the 18th of June 2020, `updated-at >= 14
days ago` matches pull requests updated after `2020-06-04T14:30:00` UTC.

```yaml
- name: close stale pull request
  conditions:
    - base = main
    - -closed
    - updated-at < 14 days 3 hours 2 minutes ago
  actions:
    close:
      message: |
        This pull request looks stale. Feel free to reopen it if you think it's a mistake.
```

## Duration

Duration can be expressed as `quantity unit [quantity unit...]` where quantity
is a number (possibly signed) and unit is second, minute, hour, or day
(abbreviations and plurals are accepted).

```text
1 day 15 hours 6 minutes 42 seconds
1 d 15 h 6 m 42 s
```

Write the units from largest to smallest, as above. Mergify reads them in that
order and stops at the first one out of place, keeping only what it read up to
there: `30 seconds 1 minute` is accepted and means 30 seconds, not one minute
and a half. A value with no unit it recognizes at all, such as `1 week`, is
rejected instead.

## Priority

Priority values can be expressed by using an integer between 1 and 10000.
You can also use those aliases:

- `low` (1000)
- `medium` (2000)
- `high` (3000)

```yaml
priority_rules:
  - name: my hotfix priority rule
    conditions:
      - base = main
      - label = hotfix
      - check-success = linters
    priority: high

  - name: my low priority rule
    conditions:
      - base = main
      - label = low
      - check-success = linters
    priority: 550
```

## Templates

Some fields are rendered as templates before Mergify uses them. They accept
*variable substitution* (short `{{ name }}` placeholders filled with pull
request data), and on an [on-premise installation](/enterprise) they also accept
the legacy [Jinja2](#legacy-template) language.

### Variable substitution

Several fields let you insert pull request data using variables:

```text
Thank you {{ author }} for your contribution!
```

renders to:

```text
Thank you jd for your contribution!
```

when the pull request author login is `jd`.

A variable is written as `{{ name }}` (surrounding spaces are optional). Every
other character is kept as-is. Each templated field accepts a specific set of
variables, documented as its data type below.

### Message template

Used by the [`comment`](/workflow/actions/comment),
[`review`](/workflow/actions/review) and [`close`](/workflow/actions/close)
message fields.

The `{{ assignees }}` and `{{ approvers }}` variables render as ready-to-use
`@`-mentions for the pull request's assignees and the people who approved it.
For example, the template:

```text
Thanks {{ approvers }} for the review!
```

renders to:

```text
Thanks @alice, @bob for the review!
```

when the pull request was approved by `alice` and `bob`.

<TemplateVariablesTable def="CommentActionModel" field="message" />

### Title template

Used by the [`copy`](/workflow/actions/copy) and
[`backport`](/workflow/actions/backport) `title` field.

<TemplateVariablesTable def="CopyActionModel" field="title" />

### Body template

Used by the [`copy`](/workflow/actions/copy) and
[`backport`](/workflow/actions/backport) `body` field.

<TemplateVariablesTable def="CopyActionModel" field="body" />

### Workflow input template

:::note
  The [`github_actions`](/workflow/actions/github_actions) action is deprecated,
  and so is this data type.
:::

Used by the [`github_actions`](/workflow/actions/github_actions) workflow input
values.

<TemplateVariablesTable def="GhaActionModelDispatch" field="inputs" />

### User

A GitHub login. You can also use the `{{ author }}` variable to target the pull
request author. Used by the [`assign`](/workflow/actions/assign) `users`,
`add_users` and `remove_users` fields.

<TemplateVariablesTable def="AssignActionModel" field="add_users" />

### Assignee

A GitHub login. You can also use `{{ author }}` (the pull request author) and
`{{ merged_by }}` (the user who merged the original pull request). Used by the
[`copy`](/workflow/actions/copy) and [`backport`](/workflow/actions/backport)
`assignees` field.

<TemplateVariablesTable def="CopyActionModel" field="assignees" />

### Bot account

A GitHub login Mergify impersonates to perform an action. You can also use the
`{{ author }}` variable to act as the pull request author.

It has to be a user account. Mergify cannot impersonate an account owned by
another GitHub App, so an action fails when the login it resolves to is a bot.

The repository has to grant that account a role, **read** at least. The access
anybody has to a public repository is not a grant, so an account that is not a
collaborator fails even where GitHub itself would let it act. **Read** is all
[`comment`](/workflow/actions/comment) and
[`review`](/workflow/actions/review) ask for;
[`request_reviews`](/workflow/actions/request_reviews) needs **triage**.

The actions that write to a pull request need **write** access:
[`backport`](/workflow/actions/backport), [`copy`](/workflow/actions/copy),
[`edit`](/workflow/actions/edit), [`rebase`](/workflow/actions/rebase),
[`squash`](/workflow/actions/squash) and [`update`](/workflow/actions/update),
along with the [`merge`](/workflow/actions/merge) action's `merge_bot_account`
and the merge queue's
[`draft_bot_account`](/configuration/file-format#queue-rules),
`merge_bot_account` and `update_bot_account`. `edit` makes an exception for the
pull request's own author. `squash` and `update` make one for the author of a
pull request opened from a fork: they impersonate that author only when edits
from maintainers are allowed on the pull request, or when that author owns the
fork and opened it.

When the field is unset, Mergify acts as itself. The two exceptions are
[`rebase`](/workflow/actions/rebase) and [`squash`](/workflow/actions/squash),
which always need somebody to impersonate: they fall back to the pull request
author, or to whoever posted the command, and fail when that resolves to
nobody, as it does on a pull request Mergify opened itself.

Used by the `bot_account` field of the [`backport`](/workflow/actions/backport),
[`comment`](/workflow/actions/comment), [`copy`](/workflow/actions/copy),
[`edit`](/workflow/actions/edit), [`rebase`](/workflow/actions/rebase),
[`request_reviews`](/workflow/actions/request_reviews),
[`review`](/workflow/actions/review), [`squash`](/workflow/actions/squash) and
[`update`](/workflow/actions/update) actions, by the
[`merge`](/workflow/actions/merge) action's `merge_bot_account`, and by the
merge queue `draft_bot_account`, `merge_bot_account` and `update_bot_account`.

<TemplateVariablesTable def="CommentActionModel" field="bot_account" />

### Legacy template

:::note
  The hosted service no longer renders Jinja2. A configuration there is read as
  if Jinja2 did not exist, so anything beyond the variables a field lists is
  ordinary text: filters, loops and `{% if %}` blocks are accepted when the
  configuration is validated and then rendered verbatim. A value that is not
  valid once read as text, such as a [bot account](#bot-account) built with
  `{% if %}`, makes the configuration invalid. Use [variable
  substitution](#variable-substitution) instead. This section describes
  on-premise installations, where Jinja2 still renders.
:::

On an on-premise installation, the template data type is a regular string that
is rendered using the [Jinja2 template
language](https://jinja.palletsprojects.com/templates/).

If you don't need any of the power coming with this templating language, you
can just use this as a regular string.

However, those templates let you use any of the [pull request
attributes](/configuration/conditions#attributes-list) in the final string.

For example the template string:

```jinja
Thank you @{{author}} for your contribution!
```

will render to:

```text
Thank you @jd for your contribution!
```

when used in your configuration file, considering the pull request author
login is `jd`.

[Jinja2
filters](https://jinja.palletsprojects.com/en/3.0.x/templates/#builtin-filters)
are supported, you can build string from list for example with:

```jinja
Approved by: @{{ approved_reviews_by | join(', @') }}
```

[Jinja2 string
manipulation](https://jinja.palletsprojects.com/en/3.0.x/templates/#python-methods>)
are also supported, you can split string for example with:

```jinja
{{ body.split('----------')[0] | trim }}
```

Mergify also provides custom Jinja2 filters:

- `markdownify`: to convert HTML to Markdown:

```jinja
{{ body | markdownify }}
```

- `get_section(<section>, <default>)`: to extract one Markdown section

```jinja
{{ body | get_section("## Description") }}
```

:::caution
You need to replace the `-` character by `_` from the [pull request attribute](/configuration/conditions#attributes-list)
names when using templates. The `-` is not a valid character for variable
names in Jinja2 template.
:::

:::note
By default, the HTML comments are stripped from `body`. To get the full
body, you can use the `body_raw` attribute.
:::

## GitHub repository permissions

Either `none`, `read`, `triage`, `write`, `maintain` or `admin`.

## Queue dequeue reason

This describes the reason why a pull request's merge queue checks ended: either
because the pull request left the queue, or because its checks were interrupted
while it stayed in the queue.

The following reasons can be reported:

<QueueDequeueReasons />

## Batch status

This describes what a [batch](/merge-queue/batches) is currently doing in the
merge queue. It is reported as the `status.code` field of each batch returned by
the [merge queue status API](/api/merge-queue), and the dashboard shows it on
each batch.

A status describes the batch as a whole, not an individual pull request: a batch
that is running its checks reports `running` for every pull request it carries.

The following statuses can be reported:

<BatchStatusCodes />

## Report mode

Report modes allow you to choose the type of report you want for your actions.
Report mode values can be expressed in the configuration as a list of strings.
The default value is `["check"]` and the list can't be empty.
To fill the list, the following report modes are available:

<table>
  <thead>
    <th>Mode</th>
    <th>Description</th>
  </thead>

  <tbody>
    <tr>
      <td><code>check</code></td>
      <td>Report the action's result as a GitHub check on the pull request. This is the default report mode.</td>
    </tr>

    <tr>
      <td><code>comment</code></td>
      <td>Report the action's result as a comment on the pull request</td>
    </tr>

  </tbody>
</table>

Report mode option is currently supported for only the following actions: [`backport`](/workflow/actions/backport), [`copy`](/workflow/actions/copy).
