From 9bc43786ec7742a57ddf836c0843f9d173cc9bae Mon Sep 17 00:00:00 2001 From: ishaileshpant Date: Mon, 13 Oct 2025 23:44:03 +0530 Subject: [PATCH] Fix payload generation to use actual form data - Use contentData.repo and contentData.path from form instead of hardcoded defaults - Add logging to show repo, path, and type values being received - This fixes the validation error where wrong path was being used - Now payload will use actual form values: repo='prepguides/go-interviews', path='patterns/README.md' - Resolves GitHub Actions validation failure with 404 errors --- api/github/create-content-pr.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/github/create-content-pr.js b/api/github/create-content-pr.js index bf48670..b2314b3 100644 --- a/api/github/create-content-pr.js +++ b/api/github/create-content-pr.js @@ -39,6 +39,9 @@ export default async function handler(req, res) { console.log('Content ID:', contentData.id); console.log('Content Title:', contentData.title); console.log('Content Category:', contentData.category); + console.log('Content Repo:', contentData.repo); + console.log('Content Path:', contentData.path); + console.log('Content Type:', contentData.type); console.log('User Token present:', !!userToken); // Try GitHub App approach - this should work without requiring user fork @@ -540,9 +543,9 @@ function generatePayloadContent(contentData, user) { id: contentData.id, title: contentData.title, description: contentData.description, - repo: "prepguides/prepguides.dev", // Default to main repo - path: `content/${contentData.category}/${contentData.id}.md`, // Default path structure - type: "guide", // Default to guide type + repo: contentData.repo || "prepguides/prepguides.dev", // Use form data or default + path: contentData.path || `content/${contentData.category}/${contentData.id}.md`, // Use form data or default + type: contentData.type || "guide", // Use form data or default status: "active" }, validation: {