mirror of
https://github.com/badges/shields.git
synced 2026-11-21 16:06:35 +03:00
* chore(deps): bump js-yaml from 4.2.0 to 5.0.0 Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.2.0 to 5.0.0. - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/4.2.0...5.0.0) --- updated-dependencies: - dependency-name: js-yaml dependency-version: 5.0.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Migrate code --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com>
20 lines
591 B
JavaScript
20 lines
591 B
JavaScript
import fs from 'fs/promises'
|
|
import got from 'got'
|
|
import * as yaml from 'js-yaml'
|
|
|
|
const resp = await got('https://api.github.com/versions').json()
|
|
const latestDate = resp.sort()[resp.length - 1]
|
|
|
|
const config = yaml.load(await fs.readFile('./config/default.yml', 'utf8'))
|
|
|
|
if (latestDate === config.public.services.github.restApiVersion) {
|
|
console.log("We're already using the latest version. No change needed.")
|
|
process.exit(0)
|
|
}
|
|
|
|
config.public.services.github.restApiVersion = latestDate
|
|
await fs.writeFile(
|
|
'./config/default.yml',
|
|
yaml.dump(config, { quoteStyle: 'double' }),
|
|
)
|