Files
shields/scripts/update-github-api.js
dependabot[bot]andPierre-Yves Bigourdan 12956aad4b chore(deps): bump js-yaml from 4.2.0 to 5.0.0; run [dynamicyaml ros conan wingetreleasedate] (#11943)
* 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>
2026-06-28 10:33:05 +00:00

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' }),
)