Skip to content

How can I generate a CHANGELOG.md based on a different commit convention? #140

Open
@aatifhsn

Description

@aatifhsn

I have my commit convention defined as '[JIRA ID]? [type] subject', I have described this commit convention using commitlint. How can I generate the CHANGELOG.md using this convention using commit-and-tag?
Below is the the code for me commitlint.config.js

module.exports = {
    parserPreset: {
      parserOpts: {
        headerPattern: /^\[(\w+-\d+)\] (\w+): (.+)/,
        headerCorrespondence: ["scope", "type", "subject"],
      },
    },
    plugins: [
      {
        rules: {
          "header-match-team-pattern": (parsed) => {
            const { type, scope, subject } = parsed;
            console.log(parsed);
            if (type === null && scope === null && subject === null) {
              return [
                false,
                "header must be in format '[JIRA ID]? [type] subject'",
              ];
            }
            return [true, ""];
          },
          "scope-type-enum": (parsed, _when, expectedValue) => {
            const { type} = parsed;
            if (type && !expectedValue.includes(type)) {
              return [
                false,
                `type must be one of ${expectedValue}`,
              ];
            }
            return [true, ""];
          },
        },
      },
    ],
    rules: {
      "header-match-team-pattern": [2, "always"],
      "scope-type-enum": [2, "always", ["fix", "feat","chore"]], // custom rule defined in plugins
    },
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions