1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Tweak the rest api ghes release script (#18509)

This commit is contained in:
Rachael Sewell
2021-03-31 10:22:25 -07:00
committed by GitHub
parent af89030b21
commit 071317da3d
2 changed files with 47 additions and 44 deletions

View File

@@ -55,10 +55,15 @@ const objectsFile = path.join(graphqlStaticDir, 'prerendered-objects.json')
const previews = require(previewsFile)
const changes = require(changesFile)
const objects = require(objectsFile)
// The prerendered objects file for the "old version" contains hardcoded links with the old version number.
// We need to update those links to include the new version to prevent a test from failing.
const regexOldVersion = new RegExp(oldVersion, 'gi')
const stringifiedObject = JSON.stringify(objects[oldVersionId])
.replace(regexOldVersion, newVersion)
previews[newVersionId] = previews[oldVersionId]
changes[newVersionId] = changes[oldVersionId]
objects[newVersionId] = objects[oldVersionId]
objects[newVersionId] = JSON.parse(stringifiedObject)
// check that it worked
if (!Object.keys(previews).includes(newVersionId)) {