Skip to content

Commit

Permalink
refactor(ci): update release titles
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW committed Dec 11, 2024
1 parent 3e0b1db commit bd0ab9f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scripts/changesets/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const REFINE_CE_TITLE = "📢 Refine Community Edition Release 📢\n";
const REFINE_CE_TITLE = "\n📢 **Refine Community Edition Release** 📢\n";

const REFINE_ENTERPRISE_TITLE = "Refine Enterprise Release ⚡\n";
const REFINE_ENTERPRISE_TITLE = "\n⚡ **Refine Enterprise Release** ⚡\n";

module.exports = {
REFINE_CE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function updateChangesetFiles() {
'": patch',
);

const body = bodyParts.join("---").trim();
const body = bodyParts.join("---");

const cleanBody = body
.replace(new RegExp(`${REFINE_ENTERPRISE_TITLE}`, "s", "g"), "")
.replace(new RegExp(`${REFINE_CE_TITLE}`, "s", "g"), "")
.replaceAll(REFINE_ENTERPRISE_TITLE, "")
.replaceAll(REFINE_CE_TITLE, "")
.trim();

const updatedContent = [
Expand All @@ -40,13 +40,13 @@ function updateChangesetFiles() {
].join("\n");

writeFileSync(filePath, updatedContent);
console.log(`File updated: ${file}`);
console.log(`File updated: ${file}`);
updatedFilesCount++;
}

console.log(`✅ Successfully updated ${updatedFilesCount} changeset files`);
} catch (error) {
console.error("Error updating changeset files:", error);
console.error("Error updating changeset files:", error);
process.exit(1);
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@ function copyChangesetFiles() {

console.log(`✅ Successfully copied ${files.length} files to _changeset`);
} catch (error) {
console.error("Error during changeset files copy operation:", error);
console.error("Error during changeset files copy operation:", error);
process.exit(1);
}
}
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/scripts/changesets/validate-changeset-titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,41 @@ function validateChangesetReleaseComments(type) {
if (isEnterprise) {
if (!hasEnterpriseTag) {
console.error(
`❌ Error: Changeset "${file}" is missing "${REFINE_ENTERPRISE_TITLE.replace(/\n/g, "")}" comment`,
`❌ Error: Changeset "${file}" is missing "${REFINE_ENTERPRISE_TITLE.replace(
/\n/g,
"",
)}" comment`,
);
hasError = true;
isValid = false;
}
if (hasCommunityTag) {
console.error(
`❌ Error: Enterprise changeset "${file}" should not include "${REFINE_CE_TITLE.replace(/\n/g, "")}" comment`,
`❌ Error: Enterprise changeset "${file}" should not include "${REFINE_CE_TITLE.replace(
/\n/g,
"",
)}" comment`,
);
hasError = true;
isValid = false;
}
} else {
if (!hasCommunityTag) {
console.error(
`❌ Error: Changeset "${file}" is missing "${REFINE_CE_TITLE.replace(/\n/g, "")}" comment`,
`❌ Error: Changeset "${file}" is missing "${REFINE_CE_TITLE.replace(
/\n/g,
"",
)}" comment`,
);
hasError = true;
isValid = false;
}
if (hasEnterpriseTag) {
console.error(
`❌ Error: Community changeset "${file}" should not include "${REFINE_ENTERPRISE_TITLE.replace(/\n/g, "")}" comment`,
`❌ Error: Community changeset "${file}" should not include "${REFINE_ENTERPRISE_TITLE.replace(
/\n/g,
"",
)}" comment`,
);
hasError = true;
isValid = false;
Expand Down

0 comments on commit bd0ab9f

Please sign in to comment.