github / github/codespaces-django

gid

未關閉
#49 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
129
分支
160
PR 合併指標
30 天內沒有已合併 PR

描述

import { Vercel } from '@vercel/sdk';

const vercel = new Vercel({
bearerToken: process.env.VERCEL_TOKEN,
});

async function setupProjectWithGitHub() {
try {
// Create a new project with GH integration
const createResponse = await vercel.projects.createProject({
requestBody: {
name: 'advanced-project',
framework: 'nextjs',
gitRepository: {
repo: 'your-username-or-orgname/your-repo-name', //The repository should have been created before and the GH account is connected to your Vercel account
type: 'github',
},
},
});

console.log(`Project created: ${createResponse.id}`);

const envResponse = await vercel.projects.createProjectEnv({
idOrName: createResponse.id,
upsert: 'true',
requestBody: [
{
key: 'DATABASE_URL',
value: 'postgresql://user:pass@host:5432/db',
type: 'encrypted', // Encrypted when saved and viewable in the Vercel dashboard with correct permissions
target: ['production', 'preview'],
},
{
key: 'API_KEY',
value: 'your-api-key',
type: 'encrypted', // Encrypted when saved and viewable in the Vercel dashboard with correct permissions
target: ['production'],
},
{
key: 'API_URL',
value: 'your-api-url',
type: 'plain',
target: ['production', 'preview'],
},
],
});

console.log('Environment variables added:', envResponse.created);
} catch (error) {
console.error(
error instanceof Error ? `Error: ${error.message}` : String(error),
);
}
}

setupProjectWithGitHub();

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。