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

Feature request: filter by scope #174

Open
allforabit opened this issue Apr 15, 2020 · 13 comments
Open

Feature request: filter by scope #174

allforabit opened this issue Apr 15, 2020 · 13 comments

Comments

@allforabit
Copy link

Perhaps this is already possible but after reading through the source code and checking the various dependencies I can't quite see a way of doing it. I would like to be able to filter the commits by scope. My use case is in a mono repo where I'm using the scope to denote which package a commit refers to. If this seems like a reasonable feature, I can do a pull request to implement. Some guidance here would be great, thanks!

@mattthaber
Copy link

i second this. Am currently looking to be able to do this functionality

@pmcjury
Copy link

pmcjury commented Aug 20, 2020

Would this cause issues with any downstream plugins?

The issue I think right now is the commits are all pulled in by git-log-parser in semantic-release itself. It currently does not return the paths in a commit --stat option. This would be required to filter messages with some glob.

https://github.com/semantic-release/semantic-release/blob/master/lib/git.js#L48

If semantic-release is able to add that to the commit context the commit analyzer filter function in the index could could simply filter by a glob or not files: ["someDir/**", "./packages/someOtherDir/**"]

@nataly87s
Copy link

nataly87s commented Aug 21, 2020

I ran into the same issue, monorepo with multiple releases.
I ended up creating my own plugin that wraps other plugins and filters the commits before passing them to the wrapped plugin.
If anyone is interested, I can open source the commit filter

@pmcjury
Copy link

pmcjury commented Aug 21, 2020

@nataly87s does the commit object contain the filename/paths?

@nataly87s
Copy link

@pmcjury no, I used this to get the filenames:

  const { exec } = require('child_process');

  const folders = await new Promise((resolve, reject) => {
    exec(
      `git diff-tree --no-commit-id --name-only ${commit.commit.long}`,
      (error, stdout, stderr) => {
        if (error) {
          reject(error);
          return;
        }
        if (stderr) {
          reject(new Error(stderr));
          return;
        }

        resolve(stdout.trim().split('\n'));
      }
    );
  });

@sinedied
Copy link

sinedied commented Mar 1, 2023

I ran into the same issue, monorepo with multiple releases. I ended up creating my own plugin that wraps other plugins and filters the commits before passing them to the wrapped plugin. If anyone is interested, I can open source the commit filter

I would be interested in this, since I'm running into the same issue! 🙂

@saleh199
Copy link

saleh199 commented Mar 5, 2023

@nataly87s I'm interested in this, having same issue with monorepo

@nataly87s
Copy link

@sinedied @saleh199
I'll have to dig out the code from three years ago 😅
I'll do it later tonight when I have some time

@sinedied
Copy link

sinedied commented Mar 6, 2023

Thanks! In the meantime I've found a workaround using https://github.com/pmowrer/semantic-release-monorepo

@saleh199
Copy link

saleh199 commented Mar 6, 2023

@sinedied this have only support for JS packages, but what about non-js packages

@sinedied
Copy link

sinedied commented Mar 6, 2023

That's why I said it was a workaround (for me), not a universal solution 😉
We definitely miss a the ability to filter commits by scope or file path, that would solve most monorepo issues (with any language).

@adem-antipodestudios
Copy link

Hello guys ! Any update on this feature request ?

@mrclrchtr
Copy link

We are also interested in this.

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

No branches or pull requests

8 participants