mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
BREAKING CHANGE: `commitlint.config.js` is not supported anymore, please use `.mjs` extension
16 lines
459 B
JavaScript
16 lines
459 B
JavaScript
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
const yaml = require('yaml')
|
|
|
|
const versionRegex = /\d+\.\d+\.\d+/
|
|
|
|
exports.readVersion = (contents) =>
|
|
yaml.parse(contents).runs.image.match(versionRegex)[0]
|
|
|
|
exports.writeVersion = (contents, version) => {
|
|
const actionFile = yaml.parse(contents)
|
|
actionFile.runs.image = actionFile.runs.image.replace(versionRegex, version)
|
|
|
|
return yaml.stringify(actionFile, {
|
|
lineWidth: 100,
|
|
})
|
|
}
|