Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aatifhsn opened this issue Apr 18, 2024 · 3 comments
Open
Labels
question Further information is requested

Comments

@aatifhsn
Copy link

aatifhsn commented Apr 18, 2024

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
    },
  };
@aatifhsn aatifhsn added the question Further information is requested label Apr 18, 2024
@aatifhsn
Copy link
Author

@TimothyJones

@TimothyJones
Copy link
Member

I'm not sure. This project is a wrapper around conventional-changelog, so if you can get that to do it, it should be straightforward.

I would start by looking at the parser options, which this project exposes.

@aatifhsn
Copy link
Author

There doesn't seem to be a way to configure these packages for any other commit messages apart from conventional commit messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants