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

Label creation adds unwanted default labels #1955

Closed
reintroducing opened this issue Apr 22, 2021 · 15 comments · Fixed by #1966
Closed

Label creation adds unwanted default labels #1955

reintroducing opened this issue Apr 22, 2021 · 15 comments · Fixed by #1966
Labels
bug Something isn't working released This issue/pull request has been released.

Comments

@reintroducing
Copy link

Describe the bug
When I run npx auto create-labels and have a given label configuration defined in my package.json, I would expect that only those labels get created, NOT the additional default labels defined by auto. This used to be the case but somewhere along the line stopped working correctly.

To Reproduce

Using the following configuration:

"auto": {
    "baseBranch": "master",
    "prereleaseBranches": [
      "next"
    ],
    "plugins": [
      [
        "npm",
        {
          "legacyAuth": true,
          "setRcToken": false
        }
      ],
      "released",
      "microsoft-teams"
    ],
    "shipit": {
      "noChangelog": true
    },
    "labels": [
      {
        "name": "breaking",
        "changelogTitle": "🚨  Breaking Changes",
        "description": "Backwards incompatible enhancement or feature.",
        "releaseType": "major",
        "color": "#c5000b"
      },
      {
        "name": "feature",
        "changelogTitle": "🚀  Features",
        "description": "A new feature.",
        "releaseType": "minor",
        "color": "#00ff00"
      },
      {
        "name": "build",
        "changelogTitle": "📦  Build Process",
        "description": "Changes to the build process.",
        "releaseType": "patch",
        "color": "#4a4a4a"
      },
      {
        "name": "chore",
        "changelogTitle": "🏗  Miscellaneous",
        "description": "Additional, uncategorized changes.",
        "releaseType": "patch",
        "color": "#ff00ff",
        "default": true
      },
      {
        "name": "ci",
        "changelogTitle": "🔖  Continuous Integration",
        "description": "Changes to CI configuration files and scripts.",
        "releaseType": "patch",
        "color": "#f1a60e"
      },
      {
        "name": "docs",
        "changelogTitle": "📖  Documentation",
        "description": "Documentation updates and changes.",
        "releaseType": "patch",
        "color": "#870048"
      },
      {
        "name": "fix",
        "changelogTitle": "🐛  Bug Fixes",
        "description": "A bug fix.",
        "releaseType": "patch",
        "color": "#6000ff"
      },
      {
        "name": "perf",
        "changelogTitle": "⚡️  Performance",
        "description": "A code change that improves performance.",
        "releaseType": "patch",
        "color": "#00e4ff"
      },
      {
        "name": "refactor",
        "changelogTitle": "♻️  Refactoring",
        "description": "A code change that neither fixes a bug nor adds a feature.",
        "releaseType": "patch",
        "color": "#00b58d"
      },
      {
        "name": "revert",
        "changelogTitle": "🚧  Reverting",
        "description": "Reverts a previous commit.",
        "releaseType": "patch",
        "color": "#ff9000"
      },
      {
        "name": "style",
        "changelogTitle": "🎨  Style",
        "description": "Code style (white-space, formatting, missing semi-colons, etc).",
        "releaseType": "patch",
        "color": "#0051d8"
      },
      {
        "name": "test",
        "changelogTitle": "✅  Testing",
        "description": "Adding missing tests or correcting existing tests.",
        "releaseType": "patch",
        "color": "#127f00"
      },
      {
        "name": "upgrade",
        "changelogTitle": "⚙️  Dependencies",
        "description": "Dependency upgrades.",
        "releaseType": "minor",
        "color": "#00787f"
      }
    ]
  }

This is the output:

Created labels: breaking, feature, build, chore, ci, docs, fix, perf, refactor, revert, style, test, upgrade, major, minor, patch, skip-release, internal, documentation, tests, dependencies, performance, released, prerelease

Expected behavior

Only the labels outlined in the above config would be created. Anything after the upgrade label in the above output list is unwanted and should not be created.

Screenshots

Environment information:

Environment Information:

"auto" version: v10.25.1
"git"  version: v2.29.2
"node" version: v12.13.0

✔ Labels configured on GitHub project

Additional context

@reintroducing reintroducing added the bug Something isn't working label Apr 22, 2021
@laughedelic
Copy link
Contributor

I was just about to file the same issue. The docs are unclear about overriding default labels. Is there a way to say that I want only those labels defined in the config and no default ones?

@hipstersmoothie
Copy link
Collaborator

There is an overwrite option on the label configuration that will override the matching default label. IDK if it will work for the zon-semver labels. could you give that a try? If the docs aren't clear enough around this more than willing to accept a PR

@reintroducing
Copy link
Author

@hipstersmoothie when looking at https://intuit.github.io/auto/docs/generated/create-labels I don't see anything of that nature. Where is the docs pertaining to this option?

@reintroducing
Copy link
Author

@reintroducing
Copy link
Author

@hipstersmoothie So looking at those docs, I guess I'm unclear about the functionality of that option. I would assume that if I add that to every one of my labels in my config, it would just overwrite the major, minor, and patch labels with mine, but would not clear out the others that are being created in addition to those. I think a nice addition would be to add an option to the create labels command that says include-defaults and set to true/false (true by default if you want to keep backwards compatibility). Thoughts?

@laughedelic
Copy link
Contributor

I agree with @reintroducing. I knew about overwrite option, but it is only about adjusting default labels if I understand it correctly. We want an option to create only the labels we configured.

@hipstersmoothie
Copy link
Collaborator

@reintroducing I like that option a lot! Default can be only create specified labels. New flag to include the others and use the overwrite logic. This would be a breaking change to behavior though. What about the opposite --no-include-defaults?

@reintroducing
Copy link
Author

@hipstersmoothie yes, sorry my explanation wasn't clear, i was suggesting the same thing you are but in reverse and it would be true by default, lol, to avoid a breaking change. yours is actually cleaner and aligns better with how all other options are done. I'm all for it!

@hipstersmoothie
Copy link
Collaborator

I might not have to to get to this until the weekend. If you submit a PR I'll review and merge prompts

@laughedelic
Copy link
Contributor

I made an attempt to fix it: #1966, but in a bit different way. See the explanation there.

@adierkens
Copy link
Collaborator

🚀 Issue was released in v10.26.0 🚀

@adierkens adierkens added the released This issue/pull request has been released. label Apr 29, 2021
@reintroducing
Copy link
Author

reintroducing commented Apr 29, 2021

@laughedelic @hipstersmoothie @adierkens I just tried the upgrade to this and am seeing the following issue in CI where we create canaries automatically on a new PR:

Screen Shot 2021-04-29 at 2 32 48 PM

It's worth noting that the actual config is in a packages/auto/config.json file and is extended at the root of our repo using the following:

"auto": {
    "extends": "./packages/auto/config.json"
  },

This was, however, working perfectly fine prior to updating to the latest version.

Here is the full config.json file:

{
  "baseBranch": "master",
  "noDefaultLabels": true,
  "prereleaseBranches": ["next"],
  "plugins": [
    [
      "npm",
      {
        "legacyAuth": true,
        "setRcToken": false
      }
    ],
    "released",
    "microsoft-teams"
  ],
  "shipit": {
    "noChangelog": true
  },
  "labels": [
    {
      "name": "breaking",
      "changelogTitle": "🚨  Breaking Changes",
      "description": "Backwards incompatible enhancement or feature.",
      "releaseType": "major",
      "color": "#c5000b"
    },
    {
      "name": "feature",
      "changelogTitle": "🚀  Features",
      "description": "A new feature.",
      "releaseType": "minor",
      "color": "#00ff00"
    },
    {
      "name": "build",
      "changelogTitle": "📦  Build Process",
      "description": "Changes to the build process.",
      "releaseType": "patch",
      "color": "#4a4a4a"
    },
    {
      "name": "chore",
      "changelogTitle": "🏗  Miscellaneous",
      "description": "Additional, uncategorized changes.",
      "releaseType": "patch",
      "color": "#ff00ff",
      "default": true
    },
    {
      "name": "ci",
      "changelogTitle": "🔖  Continuous Integration",
      "description": "Changes to CI configuration files and scripts.",
      "releaseType": "patch",
      "color": "#f1a60e"
    },
    {
      "name": "docs",
      "changelogTitle": "📖  Documentation",
      "description": "Documentation updates and changes.",
      "releaseType": "patch",
      "color": "#870048"
    },
    {
      "name": "fix",
      "changelogTitle": "🐛  Bug Fixes",
      "description": "A bug fix.",
      "releaseType": "patch",
      "color": "#6000ff"
    },
    {
      "name": "perf",
      "changelogTitle": "⚡️  Performance",
      "description": "A code change that improves performance.",
      "releaseType": "patch",
      "color": "#00e4ff"
    },
    {
      "name": "refactor",
      "changelogTitle": "♻️  Refactoring",
      "description": "A code change that neither fixes a bug nor adds a feature.",
      "releaseType": "patch",
      "color": "#00b58d"
    },
    {
      "name": "revert",
      "changelogTitle": "🚧  Reverting",
      "description": "Reverts a previous commit.",
      "releaseType": "patch",
      "color": "#ff9000"
    },
    {
      "name": "style",
      "changelogTitle": "🎨  Style",
      "description": "Code style (white-space, formatting, missing semi-colons, etc).",
      "releaseType": "patch",
      "color": "#0051d8"
    },
    {
      "name": "test",
      "changelogTitle": "✅  Testing",
      "description": "Adding missing tests or correcting existing tests.",
      "releaseType": "patch",
      "color": "#127f00"
    },
    {
      "name": "upgrade",
      "changelogTitle": "⚙️  Dependencies",
      "description": "Dependency upgrades.",
      "releaseType": "minor",
      "color": "#00787f"
    }
  ]
}

@reintroducing
Copy link
Author

Is it possible that the new option needs to be added to the validator and its as simple as that? https://github.com/intuit/auto/blob/main/packages/core/src/types.ts#L54

@laughedelic
Copy link
Contributor

Is it possible that the new option needs to be added to the validator and its as simple as that? https://github.com/intuit/auto/blob/main/packages/core/src/types.ts#L54

This makes sense! I didn't know about it.

@laughedelic
Copy link
Contributor

@reintroducing I added it here: #1971. But I don't know if it should be added anywhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants