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();

贡献指南

打开贡献指南

调研方向

The issue contains a JavaScript example using the Vercel SDK to create a project with GitHub integration and environment variables. No repository file, test, requested change, or completion criteria are identified, so the intended documentation scope and definition of done need clarification.

由索引模型根据 Issue 内容生成。

评估

技术栈
github, javascript, nextjs, postgresql
领域
cloud
Issue 类型
文档
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。