5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 16:06:56 +00:00
commitlint-github-action/.github/tasks/actionYamlUpdater.js
dependabot[bot] f8309eba38 chore(deps-dev): bump yaml from 1.10.2 to 2.0.1
Bumps [yaml](https://github.com/eemeli/yaml) from 1.10.2 to 2.0.1.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v1.10.2...v2.0.1)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-07 06:49:10 -03:00

16 lines
473 B
JavaScript

// eslint-disable-next-line import/no-extraneous-dependencies
const yaml = require('yaml')
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, {
lineWidth: 100,
})
}