mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
Some packages were updated to versions that now use ECMAScript modules, so this repo was updated to use ES modules using Node.js built-in support. Update was done using the great guide from @sindresorhus: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
16 lines
491 B
JavaScript
16 lines
491 B
JavaScript
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
const yaml = require('yaml')
|
|
|
|
yaml.scalarOptions.str.fold.lineWidth = 100
|
|
|
|
const versionRegex = /\d+\.\d+\.\d+/
|
|
|
|
module.exports.readVersion = (contents) =>
|
|
yaml.parse(contents).runs.image.match(versionRegex)[0]
|
|
|
|
module.exports.writeVersion = (contents, version) => {
|
|
const actionFile = yaml.parse(contents)
|
|
actionFile.runs.image = actionFile.runs.image.replace(versionRegex, version)
|
|
|
|
return yaml.stringify(actionFile)
|
|
}
|