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

Add scope in types #53

Open
felipecrs opened this issue Oct 7, 2020 · 5 comments
Open

Add scope in types #53

felipecrs opened this issue Oct 7, 2020 · 5 comments

Comments

@felipecrs
Copy link

felipecrs commented Oct 7, 2020

I would like to define a custom scope in types, such as:

"types": [
  { "type": "build", "scope": "deps", "section": "Dependencies Upgrade" } 
]

So I could select which commits would be part of the changelog (I don't want to include all the build type commits, only the ones matching the scope deps).

So I could use with @semantic-release/commit-analyzer:

    [
      "@semantic-release/commit-analyzer",
      {
        releaseRules: [
          {
            type: "build",
            scope: "deps",
            release: "patch",
          },
        ],
      },
    ],
@felipecrs
Copy link
Author

This feature was released in the conventionalcommits preset through conventional-changelog/conventional-changelog#669, despite not included in the schema yet.

@ext
Copy link

ext commented Dec 17, 2020

Author of the conventionalcommits preset PR here, I wasn't aware there was a specification. I can create a PR to add it to the schema and specification if you want?

@felipecrs
Copy link
Author

Actually, I'm not a maintainer of this repository. But I believe it would be good since semantic-release points this specification as the reference for configuration.

https://github.com/semantic-release/release-notes-generator#options
image

This is how people know how to use it, I guess.

@CaitlinWeb
Copy link

Specifying a scope with a type seems to be working now, though it should be noted somewhere that the order of types[] matters. I had to put the scope-specific types first, for example:

types: [
  {
    type: 'feat',
    scope: 'specific-scope',
    section: 'Specific Features'
  },
  {
    type: 'feat',
    section: 'Features'
  }
]

However, with type being required I can't hide a commit based on just scope. For example, I wanted to set up a "no-release" scope to be excluded completely from the release notes and changelog, not just excluded from triggering a release.

I had followed the example here but like this:

  "plugins": [
    ["@semantic-release/commit-analyzer", {
      "preset": "conventionalcommits",
      "presetConfig": {
        types: [...]
      },
      "releaseRules": [
        {"scope": "no-release", "release": false}
      ]
    }],
   [ '@semantic-release/release-notes-generator',  {
      "preset": "conventionalcommits",
      "presetConfig": {
        types: [...]
      }
    }]
  ]

So what I have to do currently is loop through all the types and specify scope: 'no-release' and hidden: true first, then the set all the types section etc without the scope. Ideally I'd like to do this:

types: [
  {
    scope: 'no-release',
    hidden: true
  },
  {
    type: 'feat',
    section: 'Features'
  },
  ...
]

Is there a way to support that? And let me know if I should open a new issue.

@Pho3njx
Copy link

Pho3njx commented Dec 1, 2023

Seems to be an old issue. But I would like to remind this feature request. 😁

So that it would be possible

  • either to set a wildcard in the required type:
types: [
  {
    "type": "*",
    "scope": "no-release",
    "hidden": true
  }
]
  • or leave type as optional parameter
types: [
  {
    "scope": "no-release",
    "hidden": true
  }
]

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants