github / github/codespaces-django

gid

Đang mở
#49 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
129
Fork
160
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.