7171 const userData = await userResponse.json();
7272
7373 // Prepare the data for the OpenReadme API
74+ // Build the API URL with all parameters
7475 const params = new URLSearchParams({
7576 n: userData.name || username,
7677 i: userData.avatar_url || '',
@@ -81,18 +82,19 @@ jobs:
8182 t: 'classic' // Default theme
8283 });
8384
84- const apiUrl = `${API_URL}?n=${encodeURIComponent(userData.name || username)}` +
85- `&i=${encodeURIComponent(userData.avatar_url || '')}` +
86- `&g=${encodeURIComponent(username)}` +
87- `&x=${encodeURIComponent(userData.twitter_username || '')}` +
88- `&l=` + // LinkedIn would need to be handled separately
89- `&p=${encodeURIComponent(userData.blog || userData.html_url)}` +
90- '&t=classic';
85+ const apiUrl = `${API_URL}?${params.toString()}`;
86+ console.log(`Calling API: ${apiUrl}`);
9187
92- console.log(`API URL: ${apiUrl}`); // Debug log
88+ // Call the OpenReadme API with proper headers
89+ const response = await fetch(apiUrl, {
90+ method: 'GET',
91+ headers: {
92+ 'Accept': 'application/json',
93+ 'Content-Type': 'application/json'
94+ }
95+ });
9396
94- // Call the OpenReadme API with GET method
95- const response = await fetch(apiUrl);
97+ console.log(`Response status: ${response.status} ${response.statusText}`);
9698
9799 if (!response.ok) {
98100 const error = await response.text();
@@ -144,7 +146,7 @@ jobs:
144146
145147 # Run the generation script
146148 MAPPINGS="${{ steps.user-mappings.outputs.mappings }}" \
147- API_URL="http ://localhost:3000 /api/openreadme" \
149+ API_URL="https ://openreadme.vercel.app /api/openreadme" \
148150 GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \
149151 node generate-images.js
150152
0 commit comments