mirror of
https://github.com/semantic-release/semantic-release.git
synced 2026-10-25 15:39:35 +00:00
f121540e89
Co-authored-by: alanturing881 <alanturing881@users.noreply.github.com>
21 lines
671 B
JavaScript
21 lines
671 B
JavaScript
import { isString, mapValues, omit, remove, template } from "lodash-es";
|
|
import micromatch from "micromatch";
|
|
import { getBranches } from "../git.js";
|
|
|
|
export default async (repositoryUrl, { cwd }, branches) => {
|
|
const gitBranches = await getBranches(repositoryUrl, { cwd });
|
|
|
|
return branches.reduce(
|
|
(branches, branch) => [
|
|
...branches,
|
|
...remove(gitBranches, (name) => micromatch(gitBranches, branch.name).includes(name)).map((name) => ({
|
|
name,
|
|
...mapValues(omit(branch, "name"), (value) =>
|
|
isString(value) ? template(value, { evaluate: false, escape: false })({ name }) : value
|
|
),
|
|
})),
|
|
],
|
|
[]
|
|
);
|
|
};
|