commit-analyzer
commit-analyzer copied to clipboard
Feature request: filter by scope
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!
i second this. Am currently looking to be able to do this functionality
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/**"]
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
@nataly87s does the commit object contain the filename/paths?
@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'));
}
);
});
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! 🙂
@nataly87s I'm interested in this, having same issue with monorepo
@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
Thanks! In the meantime I've found a workaround using https://github.com/pmowrer/semantic-release-monorepo
@sinedied this have only support for JS packages, but what about non-js packages
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).
Hello guys ! Any update on this feature request ?
We are also interested in this.