☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

commit_templates

Table of contents

Description:

This key defines commit message templates available when saving changes.

The value is an array of template objects. Each template object can contain optional label, template_path, template_string, wrap_width, extra_data, and _inputs keys.

Commit messages appear on the Review changes modal when you save your changes.

Type:
Array<commit_templates[*]>
Items:
[*]Object#

This key represents an individual commit template object in the commit_templates array.

The value is an object that defines a template for commit messages when saving changes. Each template object can contain optional label, template_path, template_string, wrap_width, extra_data, and _inputs keys.

Show examplesHide examples

In this example, we have configured a commit template with a template string and input configuration.

Copied to clipboard
commit_templates:
  - label: Default
    template_string: '{commit_type}: {message|trim}'
    _inputs:
      commit_type:
        type: select
        options:
          allow_empty: true
          values:
            - feature
            - fix
            - test
        cascade: true
{
  "commit_templates": [
    {
      "label": "Default",
      "template_string": "{commit_type}: {message|trim}",
      "_inputs": {
        "commit_type": {
          "type": "select",
          "options": {
            "allow_empty": true,
            "values": [
              "feature",
              "fix",
              "test"
            ]
          },
          "cascade": true
        }
      }
    }
  ]
}
Examples:

In this example, we have configured a commit template with a template string and input configuration.

Copied to clipboard
commit_templates:
  - label: Default
    template_string: '{commit_type}: {message|trim}'
    _inputs:
      commit_type:
        type: select
        options:
          allow_empty: true
          values:
            - feature
            - fix
            - test
        cascade: true
{
  "commit_templates": [
    {
      "label": "Default",
      "template_string": "{commit_type}: {message|trim}",
      "_inputs": {
        "commit_type": {
          "type": "select",
          "options": {
            "allow_empty": true,
            "values": [
              "feature",
              "fix",
              "test"
            ]
          },
          "cascade": true
        }
      }
    }
  ]
}

In this example, we have configured a commit template that uses a file for the template content.

Copied to clipboard
commit_templates:
  - label: Commit message from file
    template_path: /.git/commit-message.txt
{
  "commit_templates": [
    {
      "label": "Commit message from file",
      "template_path": "/.git/commit-message.txt"
    }
  ]
}

In this example, we have configured a commit template with a template string, input configuration, and extra data for nested templates.

Copied to clipboard
commit_templates:
  - label: Breaking change
    template_string: '{message}{breaking_change|if=breaking_change_message}'
    _inputs:
      breaking_change_message:
        type: text
    extra_data:
      breaking_change: ⚠️ {breaking_change_message}
{
  "commit_templates": [
    {
      "label": "Breaking change",
      "template_string": "{message}{breaking_change|if=breaking_change_message}",
      "_inputs": {
        "breaking_change_message": {
          "type": "text"
        }
      },
      "extra_data": {
        "breaking_change": "⚠️ {breaking_change_message}"
      }
    }
  ]
}
Open in a new tab