Skip to content

Commit

Permalink
ci(sdk): Fix some backports aren't included in the changelog (metabas…
Browse files Browse the repository at this point in the history
  • Loading branch information
WiNloSt authored Nov 14, 2024
1 parent 70ea4a0 commit 94ac40e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
gitRawCommitsOpts: { grep: "(sdk)" },
gitRawCommitsOpts: {
grep: "(sdk)",
},
options: {
preset: "angular",
pkg: {
path: "enterprise/frontend/src/embedding-sdk/package.template.json",
},
tagPrefix: "embedding-sdk-",
transform: function (commit, cb) {
if (typeof commit.gitTags === "string") {
const tagPrefix = "embedding-sdk-";
const rtag = new RegExp(`tag:\\s*[=]?${tagPrefix}(.+?)[,)]`, "gi");
const match = rtag.exec(commit.gitTags);
rtag.lastIndex = 0;
if (match) {
commit.version = match[1];
}
}
if (commit.committerDate) {
const dateFormatter = Intl.DateTimeFormat("sv-SE", {
timeZone: "UTC",
});
commit.committerDate = dateFormatter.format(
new Date(commit.committerDate),
);
}

if (hasBackportPrefix(commit)) {
const { groups } =
/\"(?<type>\w*)(?:\((?<scope>[\w\$\.\-\* ]*)\))?\: (?<message1>.*)\"(?<message2>.*)$/.exec(
commit.header,
);
commit = {
...commit,
type: groups.type,
scope: groups.scope,
subject: groups.message1 + groups.message2,
};
}

cb(null, commit);
},
},
};

function hasBackportPrefix(commit) {
return commit.header.startsWith("🤖 backported");
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
"docs-lint-links": "find docs -type f -name '*.md' -print0 | xargs -0 markdown-link-check --quiet --config .mlc_config.json",
"embedding-sdk:fixup-types-imports": "node ./bin/embedding-sdk/fixup-types-after-compilation.js",
"embedding-sdk:generate-package": "node ./bin/embedding-sdk/generate-sdk-package-files.js",
"embedding-sdk:generate-changelog": "yarn conventional-changelog -p angular --pkg enterprise/frontend/src/embedding-sdk/package.template.json --config enterprise/frontend/src/embedding-sdk/conventional-changelog-config.js --tagPrefix embedding-sdk-",
"embedding-sdk:generate-changelog": "yarn conventional-changelog --config enterprise/frontend/src/embedding-sdk/conventional-changelog-config.js",
"embedding-sdk:publish": "cd ./resources/embedding-sdk && npm publish",
"embedding-sdk:test-unit": "yarn test-unit enterprise/frontend/src/embedding-sdk/",
"embedding-sdk:tsc": "tsc --project tsconfig.sdk.json",
Expand Down

0 comments on commit 94ac40e

Please sign in to comment.