What is the intended way to use glab changelog

Hello. I have recently started used glab to automatically generate changelogs based on commit trailers.

I really like it because it can simplify changelog generation but I have some issues with this method. Using commit trailers is prone to user error . For example if someone makes a typo when writing Changelog: fixed and writes Chanelog: fixed.

I wonder what is the most optimal way to ensure that each commit is tagged with proper trailers and how to avoid user error?

You can use better commits for this, see: GitHub - Everduin94/better-commits: A CLI for creating better commits following the conventional commits specification it will automate a lot of the stuff you want to appear in the commit, to reduce typo’s.

1 Like

Oh wow. I have just tested better-commits and I quite like it!

I have modified global .better-commits.json according to my needs but I cant quite figure out how should I tell better-commits to automatically add trailers based on commit types. My .better-commits.json:

{
    "check_status": true,
    "commit_type": {
        "enable": true,
        "initial_value": "feat",
        "infer_type_from_branch": true,
        "append_emoji_to_label": false,
        "append_emoji_to_commit": false,
        "options": [
            {
                "value": "feat",
                "label": "feat",
                "hint": "A new feature",
                "emoji": "✨"
            },
            {
                "value": "fix",
                "label": "fix",
                "hint": "A bug fix",
                "emoji": "🐛"
            },
            {
                "value": "docs",
                "label": "docs",
                "hint": "Documentation only changes",
                "emoji": "📚"
            },
            {
                "value": "test",
                "label": "test",
                "hint": "Adding missing tests or correcting existing tests",
                "emoji": "🚨"
            },
            {
                "value": "ci",
                "label": "ci",
                "hint": "Changes to our CI configuration files and scripts",
                "emoji": "🤖"
            },
            {
                "value": "",
                "label": "none"
            }
        ]
    },
    "commit_scope": {
        "enable": true,
        "custom_scope": false,
        "initial_value": "app",
        "options": [
            {
                "value": "app",
                "label": "app"
            }
        ]
    },
    "check_ticket": {
        "infer_ticket": true,
        "confirm_ticket": true,
        "add_to_title": true,
        "append_hashtag": false,
        "title_position": "start"
    },
    "commit_title": {
        "max_size": 70
    },
    "commit_body": {
        "enable": true,
        "required": false
    },
    "commit_footer": {
        "enable": true,
        "initial_value": [],
        "options": [
            "closes",
            "breaking-change",
            "deprecated",
            "custom"
        ]
    },
    "breaking_change": {
        "add_exclamation_to_title": true
    },
    "confirm_commit": true,
    "print_commit_output": true,
    "branch_pre_commands": [],
    "branch_post_commands": [],
    "worktree_pre_commands": [],
    "worktree_post_commands": [],
    "branch_user": {
        "enable": true,
        "required": false,
        "separator": "/"
    },
    "branch_type": {
        "enable": true,
        "separator": "/"
    },
    "branch_ticket": {
        "enable": true,
        "required": false,
        "separator": "-"
    },
    "branch_description": {
        "max_length": 70
    },
    "branch_action_default": "branch",
    "enable_worktrees": true,
    "overrides": {}
}

Notice my commit types consists of the following:

  • feat
  • fix
  • docs
  • test
  • ci

Is there any way to generate trailers based on selected commit type?

For example, if selected commit type is feat I want to automatically append Changelog: added commit trailer

If I select commit type fix I want to automatically append Changelog: fixed to my commit message.

I am currently experimenting with better-commits and trying to figure out if this can be done. This kind of question should be posted to better-commits git :slight_smile: