From 5bdc03082f37b3a64e9f9802b5906c135cb33798 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Mon, 3 Feb 2025 21:12:58 +0000 Subject: [PATCH] Just use fetch --- .github/workflows/docs-preview-deploy.yml | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docs-preview-deploy.yml b/.github/workflows/docs-preview-deploy.yml index 525655c41ec0..d904a6dea692 100644 --- a/.github/workflows/docs-preview-deploy.yml +++ b/.github/workflows/docs-preview-deploy.yml @@ -7,25 +7,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - run: npm install @vercel/sdk - uses: actions/github-script@v7 env: VERCEL_TOKEN: secrets.VERCEL_TOKEN VERCEL_TEAM_ID: secrets.VERCEL_TEAM_ID with: script: | - const { Vercel } = await import("@vercel/sdk"); - - const vercel = new Vercel({ - bearerToken: process.env.VERCEL_TOKEN, - }); - - const deployment = await vercel.deployments.createDeployment({ - teamId: process.env.VERCEL_TEAM_ID, - requestBody: { + const res = await fetch(`https://api.vercel.com/v13/deployments?teamId=${process.env.VERCEL_TEAM_ID}`, { + "body": { name: "edgedb-docs", gitSource: { type: "github", @@ -38,6 +27,17 @@ jobs: `EDGEDB_REPO_BRANCH=${process.env.GITHUB_REF_NAME} yarn vercel-build`, }, }, + "headers": { + "Authorization": `Bearer ${process.env.VERCEL_TOKEN}` + }, + "method": "post" }); - console.log(deployment.url); + if (res.ok) { + const deployment = await res.json(); + console.log(deployment.url); + } else { + throw new Error( + `vercel create deployment api request failed: ${res.status} ${res.statusText}` + ); + }