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

import OptionsTable from '../../../components/Tables/OptionsTable';

When using templates or conditions, data are made of different types. You will
find below the different data types that are available and exposed in Mergify
configuration file.

## Commit

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

<OptionsTable def="Commit" />

You can use a commit object in templates:

```jinja
{% for commit in commits %}
Co-Authored-By: {{ commit.author }} <{{ commit.email_author }}>
{% endfor %}
```

You can also use those objects in conditions:

```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!
```

## Commit Author

<OptionsTable def="CommitAuthor" />

## Globs

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

{/* 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. |
{/* 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. |

## Regular Expressions

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

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

Mergify leverages [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 contains only days, only times or
both and can have a timezone specified with the times (for the list of
available time zones, see [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 `!=`.
:::

```yaml
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
```

## 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).

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/XXXX-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]
```

## 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

If the current date is 18th June 2020, `updated-at >= 14 days ago` is
translated to `updated-at >= 2020-06-04T00:00:00`.

```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); unit is second, minute, hour, day, week, or
abbreviations or plurals of these units;

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

## 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
```

## Template

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 allow to 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 has been removed from the queue.

<table>
  <thead>
    <th>Reason</th>
    <th>Description</th>
  </thead>

  <tbody>
     <tr>
      <td><code>none</code></td>
      <td>Pull request was not and is not in any queue.</td>
    </tr>

    <tr>
      <td><code>pr-merged</code></td>
      <td>Pull request has been merged.</td>
    </tr>

    <tr>
      <td><code>pr-dequeued</code></td>

      <td>
        Pull request has been removed from the queue by an
        <a href="/commands/dequeue">dequeue command</a> or
        by an <a href="/workflow">automation rule</a>
      </td>
    </tr>

    <tr>
      <td><code>checks-timeout</code></td>

      <td>
        The configured <a href="/configuration/file-format/#queue-rules">
        <code>checks\_timeout</code></a> has been reached.
      </td>
    </tr>

    <tr>
      <td><code>checks-failed</code></td>
      <td>The checks have failed.</td>
    </tr>

    <tr>
      <td><code>queue-rule-missing</code></td>
      <td>The queue rule has been removed from the configuration.</td>
    </tr>

    <tr>
      <td><code>base-branch-missing</code></td>
      <td>The pull request base branch is missing.</td>
    </tr>

    <tr>
      <td><code>base-branch-changed</code></td>
      <td>The pull request base branch has changed.</td>
    </tr>

    <tr>
      <td><code>pr-unexpectedly-failed-to-merge</code></td>
      <td>An unexpected error happened while merging the pull request.</td>
    </tr>

    <tr>
      <td><code>batch-max-failure-resolution-attempts</code></td>
      <td>The maximum number of resolution attempts set in <a href="/configuration/file-format/#queue-rules">
      <code>batch\_max\_failure\_resolution\_attempts</code></a> has been reached.</td>
    </tr>

    <tr>
      <td><code>conflict-with-base-branch</code></td>
      <td>The pull request conflicts with its base branch.</td>
    </tr>

    <tr>
      <td><code>conflict-with-pull-ahead</code></td>
      <td>The pull request conflicts with a pull request ahead of it.</td>
    </tr>

    <tr>
      <td><code>branch-update-failed</code></td>
      <td>Updating the head branch of the pull request failed.</td>
    </tr>

    <tr>
      <td><code>pr-ahead-dequeued</code></td>
      <td>A pull request which is ahead has been removed from the queue.</td>
    </tr>

    <tr>
        <td><code>pr-ahead-failed-to-merge</code></td>
        <td>The pull request which is ahead could not be merged.</td>
    </tr>

    <tr>
        <td><code>pr-with-higher-priority-queued</code></td>
        <td>A higher priority pull request has been queued in the meantime.</td>
    </tr>

    <tr>
        <td><code>pr-queued-twice</code></td>
        <td>The pull request got queued twice.</td>
    </tr>

    <tr>
        <td><code>pr-frozen-no-cascading</code></td>
        <td>The pull request was frozen by a freeze with cascading effect disabled.</td>
    </tr>

    <tr>
        <td><code>pr-checks-stopped-because-merge-queue-pause</code></td>
        <td>The checks have been interrupted because the merge queue is paused on this repository.</td>
    </tr>

    <tr>
        <td><code>draft-pull-request-changed</code></td>
        <td>The draft pull request has been unexpectedly changed.</td>
    </tr>

    <tr>
        <td><code>pull-request-updated</code></td>
        <td>The pull request has been manually updated.</td>
    </tr>

    <tr>
        <td><code>merge-queue-reset</code></td>
        <td>The merge queue was reset.</td>
    </tr>

    <tr>
        <td><code>incompatibility-with-branch-protections</code></td>
        <td>The pull request cannot be checked because of an incompatibility with branch protections.</td>
    </tr>
  </tbody>
</table>

## Report Modes

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).
