Unverified Commit 083dd2a5 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub
parent 7c189c5c
...@@ -81,16 +81,28 @@ async function main() { ...@@ -81,16 +81,28 @@ async function main() {
Authorization: `Bearer ${githubToken}`, Authorization: `Bearer ${githubToken}`,
'X-GitHub-Api-Version': '2022-11-28', 'X-GitHub-Api-Version': '2022-11-28',
} }
const { version } = require('../lerna.json') let { version } = require('../lerna.json')
version = `v${version}`
const releaseUrlRes = await fetch( const releaseUrlRes = await fetch(
`https://api.github.com/repos/vercel/next.js/releases/tag/${version}`, `https://api.github.com/repos/vercel/next.js/releases`,
{ {
headers: ghHeaders, headers: ghHeaders,
} }
) )
const { url } = await releaseUrlRes.json() const releasesData = await releaseUrlRes.json()
const undraftRes = await fetch(url, {
const release = releasesData.find(
(release) => release.tag_name === version
)
if (!release) {
console.log(`Failed to find release`, releasesData)
return
}
const undraftRes = await fetch(release.url, {
headers: ghHeaders, headers: ghHeaders,
method: 'PATCH', method: 'PATCH',
body: JSON.stringify({ body: JSON.stringify({
...@@ -100,7 +112,7 @@ async function main() { ...@@ -100,7 +112,7 @@ async function main() {
}) })
if (undraftRes.ok) { if (undraftRes.ok) {
console.log('undrafted canary release successfuly') console.log('un-drafted canary release successfully')
} else { } else {
console.log(`Failed to undraft`, await undraftRes.text()) console.log(`Failed to undraft`, await undraftRes.text())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment