fix(release): changelog filtering logic for the project commits (#31449)
This commit is contained in:
parent
601fecdf0c
commit
c5146d1b5f
@ -533,18 +533,18 @@ export function createAPI(overrideReleaseConfig: NxReleaseConfiguration) {
|
|||||||
|
|
||||||
if (!fromRef && useAutomaticFromRef) {
|
if (!fromRef && useAutomaticFromRef) {
|
||||||
const firstCommit = await getFirstGitCommit();
|
const firstCommit = await getFirstGitCommit();
|
||||||
const allCommits = await getCommits(firstCommit, toSHA);
|
commits = await filterProjectCommits({
|
||||||
const commitsForProject = allCommits.filter((c) =>
|
fromSHA: firstCommit,
|
||||||
c.affectedFiles.find((f) => f.startsWith(project.data.root))
|
toSHA,
|
||||||
);
|
projectPath: project.data.root,
|
||||||
|
});
|
||||||
|
|
||||||
fromRef = commitsForProject[0]?.shortHash;
|
fromRef = commits[0]?.shortHash;
|
||||||
if (args.verbose) {
|
if (args.verbose) {
|
||||||
console.log(
|
console.log(
|
||||||
`Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`
|
`Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
commits = commitsForProject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fromRef && !commits) {
|
if (!fromRef && !commits) {
|
||||||
@ -554,7 +554,11 @@ export function createAPI(overrideReleaseConfig: NxReleaseConfiguration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!commits) {
|
if (!commits) {
|
||||||
commits = await getCommits(fromRef, toSHA);
|
commits = await filterProjectCommits({
|
||||||
|
fromSHA: fromRef,
|
||||||
|
toSHA,
|
||||||
|
projectPath: project.data.root,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const { fileMap } = await createFileMapUsingProjectGraph(
|
const { fileMap } = await createFileMapUsingProjectGraph(
|
||||||
@ -1349,6 +1353,21 @@ async function getCommits(
|
|||||||
return parseCommits(rawCommits);
|
return parseCommits(rawCommits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function filterProjectCommits({
|
||||||
|
fromSHA,
|
||||||
|
toSHA,
|
||||||
|
projectPath,
|
||||||
|
}: {
|
||||||
|
fromSHA: string;
|
||||||
|
toSHA: string;
|
||||||
|
projectPath: string;
|
||||||
|
}) {
|
||||||
|
const allCommits = await getCommits(fromSHA, toSHA);
|
||||||
|
return allCommits.filter((c) =>
|
||||||
|
c.affectedFiles.find((f) => f.startsWith(projectPath))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function filterHiddenChanges(
|
function filterHiddenChanges(
|
||||||
changes: ChangelogChange[],
|
changes: ChangelogChange[],
|
||||||
conventionalCommitsConfig: NxReleaseConfig['conventionalCommits']
|
conventionalCommitsConfig: NxReleaseConfig['conventionalCommits']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user