Skip to content

Commit

Permalink
Add helper function to update change during merge workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mukulmishra18 committed Dec 27, 2023
1 parent 674921f commit 9fc5da1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/scripts/updateChangelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Updates the changelog by replacing the changelog header with the correct version
*
* @param {string} changelogString the content of the changelog file
* @param {string} version the player version to be released
* @param {string} releaseDate the release date to be written to the changelog
*/
function updateChangeLog(changelogString, version, releaseDate) {
const optionalBetaOrRc = '(-rc.d+)?(-(b|beta).d+)?';
const changelogVersionRegExp = new RegExp(
`\\[(development|develop|unreleased|${version})${optionalBetaOrRc}.*`,
'gi',
);
return changelogString.replace(changelogVersionRegExp, `[${version}] - ${releaseDate}`);
}

module.exports.updateChangeLog = updateChangeLog;

0 comments on commit 9fc5da1

Please sign in to comment.