Skip to content

Commit 15a02ad

Browse files
pwizlameganelachenyweb-flowunrevised6419tung-eh
authored
Test next AI enhancements on docs-next (#2676)
* Update deploy-production.yml * Add link to BC entry for REST API (documentId vs. id) * Revert "Add link to BC entry for REST API (documentId vs. id)" This reverts commit 09ba5e4. * Add link to BC entry for REST API (documentId vs. id) * Increase modal size to 720px (#2536) * Add inline prop to custom Badge component (#2538) * Add very tricky test * Add inline prop to Badge for tabs edge cases * Update docusaurus/docs/cms/features/content-type-builder.md * Add config. parameter to allow Kapa analytics (#2540) * Expandable card docs wrapper (#2541) * Add config. parameter to allow Kapa analytics * Add first draft of ExpandableCardDocsWrapper and use it in U&P docs * Update CSS to make buttons more subtle * Update component and style to have icons more aligned with text * Add tip about Copy Markdown and llms.txt files (#2543) * Ignore LLMs.txt-related files * CMS Docs: Conditional Fields (beta release) (#2539) * Create snippet for conditional fields + Add it in CTB docs * Fix wording for basic settings * Add new inline badge --------- Co-authored-by: Pierre Wizla <[email protected]> * Bump version to 6.6.0 * Update what's new page with latest AI related options * Add 6.6.0 release notes * Add link to blog article about webhooks and Next.js (#2549) * Add repeatable components/Document Service API breaking change (#2551) * Add breaking change entry for repeatable components * Add link to DS API update method ref. * Add the breaking change * Fix broken GH worflow by removing llms*.txt files from .gitignore * Also remove /static from .gitignore * 🤖 Update LLMs files [skip ci] * Add link to another REST-related blog post * [experimental] Add Strapi 12 Rules automated documentation validation (#2556) * feat: Add Strapi 12 Rules automated documentation validation - Implement automated style checking based on Strapi's 12 Rules of Technical Writing - Critical rules block PRs: procedures in numbered lists, no easy/difficult, professional tone - GitHub Action comments PRs with specific violations and suggestions - Support for all content, structure, and formatting rules * Remove workflow file * Delete docusaurus/docs/test-file.md * Delete docusaurus/style-check-results.json * Create documentation-review.yml * Fix dependency issues in documentation-review.yml * Improve documentation-review.yml messages * Add workflow dispatch to documentation-review.yml * Fix node version requirement in documentation-review.yml * Fix manual runs (workflow dispatch) implementation of documentation-review.yml * Create debug-review.yml * Update validate-content-style.js * Improve debug-review.yml * Fix validate-content-style.js with correct paths * Fix bad argument syntax in documentation-review.yml * Try to fix file path validation documentation-review.yml * Fix syntax error in documentation-review.yml * Fix again syntax error in documentation-review.yml * Fix yet another syntax error in documentation-review.yml * Hopefully finally fix documentation-review.yml *cough* * Try to fix permissions and file path validation in documentation-review.yml * Update manual dispatch in documentation-review.yml to avoid asking the branch * Fix new error syntax in documentation-review.yml 😅 * Update documentation-review.yml to handle only PR-modified files * Update validate-content-style.js to handle multiple use cases * Fix syntax error from prev. commit in documentation-review.yml and clean up file * Fix bad SHA issue(s) in documentation-review.yml * Fix syntax errors from prev. commit in documentation-review.yml * Ignore React components validation in rule-parser.js * Increase tolerated number of list items to 5 in style-rules.yml * Temporarily disable automatic trigger of documentation-review.yml To prevent frustrating users with an experimental workflow :D * Fix duplicate header in documentation-review.yml * Reduce tolerated number of enumerated items in style-rules.yml * Update package.json * Update release notes * Use new notation for accessing plugin config (#2562) * Fix link to 12 rules in documentation-review.yml * Create documentation-review-github.yml * Create gthub-diff-parser.js * Create validate-content-style-github.js * Update rule-parser.js * Update style-rules.yml * Rename gthub-diff-parser.js to github-diff-parser.js * Fix resources path in documentation-review-github.yml * Update style-rules.yml: 3 → 5 items for enumerations * Use ultra-strict mode for diff parser * Add local diff test script * Fix community license link * Add local/inline test-content.js for PR review automation tests * Add tmp ignored files during testing phase * Improve PR QA automation with friendly reporting and inline comments * Improve validator further * Create documentation-style-review-enhanced.yml * Try to fix inline comment posting in documentation-style-review-enhanced.yml * Fix beta badge color in dark mode * Remove duplicated sections in Preview docs (#2568) * 🤖 Update LLMs files [skip ci] * Improve content validator with better messages and multiple rules handling * Fix path for ruleParser from prev. commit * Fix regression from ruleParser commit * Extract real content for suggestions * Add debug options for content extraction * Allow longer quotes in content suggestions * Improve messaging * Improve procedures detection in style-rules.yml * Test upgrading numbered lists issue to critical errors * Revert "Test upgrading numbered lists issue to critical errors" This reverts commit 6feea5a. * Tooltips in TOC (#2561) * Add tooltip * Simplify usage * Remove tooltip test from sidebar * Get clickable "notice" components that expands upon click * Convert it to hover effect * Refine tooltip style further * Refine tooltip examples in sidebars.js * Fix styles * Refine tooltips examples & styles * Slightly tweak dark mode tooltip styles * Translate code comment * Translate code comment * Add comment on how to use value in HTML notices * Fix gitignore * Apply various examples of tooltips to TOC * Adjust CSS * Rename properties for HTML type to better handle tooltips * Fix admin panel custom. tooltip * 🤖 Update LLMs files [skip ci] * Remove beta badges (#2554) * Add release notes for 6.6.2 * Bump to 6.6.2 * Fix Amplitude tracking experiment CDN (#2574) * chore: put the right tracking experiment cdn * chore: make the amplitude tracking a plugin * Cloud: Update content for Canny widget * fix: broken line breaks in step-by-step file (#2580) * Update docker.md (#2578) Corrected strapi network mismatch issues. In docker compose everywhere "strapi" as network has been used but in the last segment where network is explicitly is defined it is written "Strapi" due to which while running docker compose up -d it terminates old container and restricts new container due to network mismatch and then i had to manually delete old container and run new container with new network name. * Update document-service.md (#2586) Fix incorrect wording in locale documentation * Hide second footer (#2588) * Revert "Hide second footer (#2588)" This reverts commit 86daad3. * Hide second footer (#2589) * Re-fix duplicate footer 😅 * Add release notes for 6.6.3 * Bump to 6.6.3 * Add mention about building in QSG (#2590) * Fix color for highlighted code lines * Document release statuses in Releases feature page * Expand strapi generate documentation (#2593) * Add ExpandableContent component * Augment strapi generate CLI docs & use ExpandableContent component * Ensure collapsing content scrolls back to button * Improve ExpandableComponent design * Improve formatting * Add GIF * 🤖 Update LLMs files [skip ci] * Improve strapi-generate docs further (#2595) Expands upon PR #2593 * Be slightly more specific in content-types config. options for generate * Document pluginOptions in Models * Rework pluginOptions table * Fix mistake in pluginOptions descriptions in table * Add subscription cancellation section in Cloud Billing & Usage docs * Add details about strapi.console * Add callout about overriding image function in Plugins extension docs * Add callout in Media Library doc to redirect users to the plugin extension doc * Stop tracking llms-full.txt * Initialization section updates Clearer examples and addition of error message if baseURL is missing protocol * Update Authentication section Added note that this is the only auth method currently; added error message * Ditched [source] Standardising with rest of docs * Upload file additions * chore: update Strapi Cloud settings screenshots (#2585) * Docusaurus improvements * Fix formatting * Revert "Fix formatting" This reverts commit edd788d. * Draft documentation for new transfer ownership feature * Remove LLMS-full.txt * Remove LLMS-full.txt * Improve structure so that the new upload-related information better fits with the existing information architecture * Update version in package.json * Update release notes * Fix broken anchors * re-add llms-full.txt * 🤖 Update LLMs files [skip ci] * Fix tabs display with long labels (#2605) * Add tabs--allow-multiline class to handle tabs with long labels * Use it on document concept page * Quickly update the Preview docs to mention Desktop/Mobile switch (#2607) * 🤖 Update LLMs files [skip ci] * Fix MermaidWithFallback diagram display (#2609) was not properly loading diagrams when switching tabs * Update docusaurus/docs/cms/api/client.md Co-authored-by: Jamie Howard <[email protected]> * Update docusaurus/docs/cms/api/client.md Co-authored-by: Jamie Howard <[email protected]> * Reverted authentication info change U&P is usable now (but still not documented here) * Review comments * Update formatting (no title case) * Use proper ExternalLink component for link to source code * Improve and complete transfer ownership doc * Better explain the move to `documentId` (#2604) * Expand Document Service API introduction * Improve formatting for additional resources in breaking change page * Fine-tune introduction wording * Mention why using documentId is recommended * 🤖 Update LLMs files [skip ci] * 🤖 Update LLMs files [skip ci] * Async project creation on Strapi Cloud (#2581) * chore: updated account repository selection images * feat: documentation for async project creation * feat: documentation for async environment creation * Apply suggestions from code review Co-authored-by: Pierre Wizla <[email protected]> --------- Co-authored-by: Pierre Wizla <[email protected]> * 🤖 Update LLMs files [skip ci] * Improve transfer ownership docs to mention the possibility to request ownership as maintainer * Explain there's only one GraphQL endpoint and how to customize its URL (#2617) * Explain there's only one GraphQL endpoint and how to customize its URL * Fix tone * Mention DS API findOne returns null if no document found (#2614) * GraphQL & REST API: more information on operators & more examples (#2615) * Add simple examples + improve existing example for GraphQL API filters * remove TODO comment * Show more simple GraphQL examples by default * Add more information on filters in REST API * Make complex REST API example for complex * Try other formatting for GraphQL API examples * Go back to previous formatting for GraphQL API simple examples * Document missing eqi and nei operators for GraphQL API * 🤖 Update LLMs files [skip ci] * Improve GraphQL queries explanations (Flat vs. Relay-style) (#2621) * docs: expand v5 migration info * Use caution callout instead of note * Remove unwanted added note about upgrading * Add blank line * Add blank line * Ensure code blocks are properly indented in instructions * Add link to documentId breaking change * Increase timeout of auto-respond-issues.yml * Update screenshots * Fix content * Bump version to 6.6.5 * Add release notes for 6.6.5 * Update admin panel doc to add new 'Reset guided tour' setting (#2612) * 🤖 Update LLMs files [skip ci] * feat: documentation for download backup (#2582) * 🤖 Update LLMs files [skip ci] * Add precisions on transfer ownership * Add badges * Fix another issue * 🤖 Update LLMs files [skip ci] * Add experimental firstPublishedAt configuration (#2636) * docs: add firstPublishedAt future flag * Move paragraph to config. heading and add cross-link * Fix 'v4CompatibilityMode' typo for Strapi 5 migration (#2635) * fix typo * fix typo * 🤖 Update LLMs files [skip ci] * Update step-by-step.md (#2640) * 🤖 Update LLMs files [skip ci] * Fix typo in features config. example * Improve environment variables page (#2639) * docs: add sample env file and link * Update docusaurus/docs/cms/deployment.md * Update sample-env.md * Update environment.md * Update sample-env.md * Update sample-env.md * Reformat * Add heading for easier linking * Add links to feature pages * Fix anchor link * Add advanced queries and policies guides to GraphQL docs (#2634) * Add advanced queries and policies guides to GraphQL docs * Update titles in YAML cartridge * Improve PostgreSQL database config. example (#2643) * docs: clarify content manager panel api (#2646) * Improve backend service docs (#2648) * Add note in Server config doc about keep alive configuration (#2645) * 🤖 Update LLMs files [skip ci] * Add release notes for 6.6.6 * Add callout in database config with precisions on data.db path (#2655) * Clarify `database` vs. `filename` usage in database configuration (#2657) * Add release notes for 6.6.6 * Clarify `database` vs. `filename` depending on database type Useful with #2655 * Bump version to 6.6.6 * Update release notes * Add missing word to release numbers explanations * docs: update controller sanitization (#2661) * 🤖 Update LLMs files [skip ci] * Update functions.md (#2660) Correct small mistake bootstrapi() -> bootstrap() * 🤖 Update LLMs files [skip ci] * Fix unwanted blank space * 🤖 Update LLMs files [skip ci] * Fix no search results for `db.query` (#2667) * Update APIs introduction so db.query now appears in search results * Ensure prerequisites are shown on each page * Document flat archive structure for import and export (#2658) * docs(data-management): document flat archive structure for import and export * Clarify import/export tables in flat structure * Add proper next/prev entries to data management pages * Improve copy of db.query in Content API intro. This improves upon PR #2667 * 🤖 Update LLMs files [skip ci] * Update EOS date * Update old caution * 🤖 Update LLMs files [skip ci] * Fix missing blank lines * Fix LLMs.txt * Add example questions to Kapa AI modal * Add DebugComponent * Add first skeleton of AiToolbar component and its logic * Add Copy Markdown button logic and style and test it on CMS intro page * Improve button styles * Swizzle heading component to include AiToolbar in all h1s * Add LLMs buttons * Fix dark mode * Remove Copy Markdown button from secondary TOC * Remove LLM txt files from footer * Move AiToolbar to left * Add special hook to ensure badges are displayed before AiToolbar * Add missing h1s to some pages so that the AiToolbar is displayed, because it's part of headings * Fix margin around badges container * Add description to hook * Open API spec generation (#2665) * Open API spec generation * Update docusaurus/docs/cms/api/openapi.md Co-authored-by: Jamie Howard <[email protected]> * Update docusaurus/docs/cms/api/openapi.md Co-authored-by: Jamie Howard <[email protected]> * Rework the Open API file * Improve CLI entry * Add it to What's new? page * Add it to sidebar * Update LLMs-full.txt * Add screenshot * Add info. about contrib. docs * Improve copy * Add example file * Fix tabs formatting * Fix title casing * Move CLI entry docs higher * Clarify a heading * Fix tags * Wrap example in ExpandableContent component * Shorten intro. * Add more links to middlewares config. docs * Clarify intro * Fix casing of labels for a yarn/npm tabs group --------- Co-authored-by: Jamie Howard <[email protected]> Co-authored-by: Pierre Wizla <[email protected]> Co-authored-by: Pierre Wizla <[email protected]> * 🤖 Update LLMs files [skip ci] * Update Admin Panel and Homepage customization pages with new widgets and new guided tour UI (#2671) * Fix missing blank lines * Update admin panel and homepage customization pages with new UI * v6.7.0 * Implement first version * Revise approach and include Ask AI button in existing button group * Refine style, pt. 1 * Refine style, pt. 2 * Increase Kapa modal size * Increase Kapa modal size * Remove unused files * Also remove unused ContextualizedAIButton code since we simplified the architecture and only "swizzle" the default Code block from Docusaurus 3.x * Add comment to test Vercel deploy * Update yarn.lock * Update LLMs txt files --------- Co-authored-by: meganelacheny <[email protected]> Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: unrevised6419 <[email protected]> Co-authored-by: Tung Nguyen <[email protected]> Co-authored-by: Maxime Castres <[email protected]> Co-authored-by: mariekirsch <[email protected]> Co-authored-by: ndaemy <[email protected]> Co-authored-by: Tasleem222 <[email protected]> Co-authored-by: Felix M. <[email protected]> Co-authored-by: Hannah Paine <[email protected]> Co-authored-by: mariekirsch <[email protected]> Co-authored-by: Jamie Howard <[email protected]> Co-authored-by: Michael Sadcenko <[email protected]> Co-authored-by: devios327 <[email protected]> Co-authored-by: Marco A. <[email protected]>
1 parent 03b1f7d commit 15a02ad

File tree

76 files changed

+8877
-884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+8877
-884
lines changed
Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
name: Auto-respond to Issues
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
workflow_dispatch:
7+
inputs:
8+
issue_number:
9+
description: 'Number of issue to handle'
10+
required: true
11+
type: string
12+
13+
permissions:
14+
issues: write
15+
contents: read
16+
17+
jobs:
18+
auto-respond:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '18'
28+
29+
- name: Install dependencies
30+
run: |
31+
npm install axios @octokit/rest
32+
33+
- name: Process issue and generate response
34+
id: process-issue
35+
uses: actions/github-script@v7
36+
with:
37+
script: |
38+
const axios = require('axios');
39+
40+
// Get issue details - handle both automatic and manual triggers
41+
let issue, issueTitle, issueBody, issueNumber, issueAuthor;
42+
43+
if (context.payload.inputs?.issue_number) {
44+
// Manual trigger - fetch issue details
45+
const issueResponse = await github.rest.issues.get({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: parseInt(context.payload.inputs.issue_number)
49+
});
50+
issue = issueResponse.data;
51+
issueTitle = issue.title;
52+
issueBody = issue.body || '';
53+
issueNumber = issue.number;
54+
issueAuthor = issue.user.login;
55+
} else {
56+
// Automatic trigger - use context
57+
issue = context.payload.issue;
58+
issueTitle = issue.title;
59+
issueBody = issue.body || '';
60+
issueNumber = issue.number;
61+
issueAuthor = issue.user.login;
62+
}
63+
64+
console.log(`Processing issue #${issueNumber}: ${issueTitle}`);
65+
66+
// Skip if issue is from a maintainer/collaborator
67+
const collaborators = ['pwizla'];
68+
const isTesting = issueTitle.includes('[TEST]') || issueBody.includes('testing-auto-response');
69+
70+
if (collaborators.includes(issueAuthor) && !isTesting) {
71+
console.log('Issue from maintainer, skipping auto-response');
72+
return;
73+
}
74+
75+
// Prepare the enhanced query for Kapa AI
76+
const cleanedBody = issueBody
77+
.replace(/<!--[\s\S]*?-->/g, '') // Remove HTML comments
78+
.replace(/\n_No response_\s*$/gm, '') // Remove "No response" placeholders
79+
.replace(/Automatic sync of commit from main/g, '') // Remove auto-sync indicators
80+
.replace(/\n{3,}/g, '\n\n') // Clean up multiple newlines
81+
.trim();
82+
83+
const finalBody = cleanedBody.length < 20 ?
84+
`${cleanedBody}\n\n(Note: This is a brief issue description. The title "${issueTitle}" may contain additional context.)` :
85+
cleanedBody;
86+
87+
const query = [
88+
"I need to provide a helpful, friendly, and comprehensive response to a GitHub issue from the Strapi community.",
89+
"",
90+
"**Issue Title:** " + issueTitle,
91+
"",
92+
"**Issue Description:**",
93+
finalBody,
94+
"",
95+
"Please provide a response that:",
96+
"",
97+
"1. **Tone & Approach:**",
98+
" - Be warm, welcoming, and supportive - this represents the Strapi brand",
99+
" - Show empathy for the user's situation and acknowledge their effort in reporting the issue",
100+
" - Use friendly language that makes the user feel valued in our community",
101+
" - Keep the introduction concise and professional - avoid overly lengthy greetings",
102+
"2. **Technical Content:**",
103+
" - Directly address the question or problem described",
104+
" - Provide relevant code examples, configuration snippets, or step-by-step guidance when applicable",
105+
" - Include links to official Strapi documentation that can help",
106+
" - If the issue involves a bug, acknowledge it and provide workarounds if possible",
107+
" - If it's a feature request, explain current alternatives or suggest next steps",
108+
"",
109+
"3. **Response Guidelines:**",
110+
" - If you cannot find specific information to answer this question, be honest about it",
111+
" - Suggest where the user might find more resources (Discord, documentation sections, etc.)",
112+
" - For complex issues, break down the response into clear, actionable steps",
113+
" - If the issue seems like it requires core team attention, indicate that appropriately",
114+
" - If suggesting feature requests or improvements, direct users to https://feedback.strapi.io",
115+
" - If the issue seems to be a product bug or core functionality issue rather than documentation, clearly mention this and format the username as `@pwizla` (with backticks) for potential transfer to strapi/strapi repository", "",
116+
"Please craft a response that will be posted as an automated GitHub comment, so it should be complete and helpful on its own while being genuinely friendly and supportive."
117+
].join('\n');
118+
119+
try {
120+
// Call Kapa AI Chat API
121+
const kapaApiUrl = `https://api.kapa.ai/query/v1/projects/${process.env.KAPA_PROJECT_ID}/chat/`;
122+
123+
console.log(`Calling Kapa Chat API: ${kapaApiUrl}`);
124+
125+
const kapaResponse = await axios.post(kapaApiUrl, {
126+
query: query,
127+
user_data: {
128+
source: 'github-automation',
129+
issue_number: issueNumber,
130+
author: issueAuthor
131+
}
132+
}, {
133+
headers: {
134+
'X-API-Key': process.env.KAPA_API_TOKEN,
135+
'Content-Type': 'application/json',
136+
'User-Agent': 'Strapi-Docs-GitHub-Bot/1.0'
137+
},
138+
timeout: 120000 // 2-minute timeout
139+
});
140+
141+
console.log('Kapa API response received');
142+
143+
// Extract response data - updated for actual Kapa response structure
144+
const aiResponse = kapaResponse.data.answer;
145+
const sources = kapaResponse.data.relevant_sources || [];
146+
const isUncertain = kapaResponse.data.is_uncertain || false;
147+
148+
if (!aiResponse) {
149+
throw new Error('No answer received from Kapa AI');
150+
}
151+
152+
// Format the response
153+
let responseBody = `🤖 I've analyzed your question and here's what I found:\n\n`;
154+
155+
// Add uncertainty warning if needed
156+
if (isUncertain) {
157+
responseBody += `⚠️ *Note: This response may not be completely accurate. Please verify the information.*\n\n`;
158+
}
159+
160+
responseBody += `${aiResponse}\n\n`;
161+
162+
if (sources.length > 0) {
163+
responseBody += `📚 **Relevant documentation:**\n`;
164+
165+
// Process and format sources
166+
const formattedSources = sources
167+
.filter(source => source.source_url && source.source_url.startsWith('http') && source.title !== 'Documentation')
168+
.map(source => {
169+
const url = source.source_url;
170+
let title = source.title || 'Documentation';
171+
172+
// Handle pipe-separated title|subtitle format
173+
if (title.includes('|')) {
174+
const parts = title.split('|');
175+
const pageTitle = parts[0].trim();
176+
const sectionTitle = parts[1].trim();
177+
178+
// If section title is different from page title, format as "Page - Section"
179+
if (sectionTitle && sectionTitle !== pageTitle) {
180+
title = `${pageTitle} - ${sectionTitle}`;
181+
} else {
182+
title = pageTitle;
183+
}
184+
}
185+
186+
return { title, url };
187+
})
188+
.sort((a, b) => a.title.localeCompare(b.title)); // Sort alphabetically by title
189+
190+
// Remove duplicates (same title and URL)
191+
const uniqueSources = formattedSources.filter((source, index, array) =>
192+
index === array.findIndex(s => s.title === source.title && s.url === source.url)
193+
);
194+
195+
uniqueSources.forEach(source => {
196+
responseBody += `- [${source.title}](${source.url})\n`;
197+
});
198+
responseBody += `\n`;
199+
}
200+
201+
responseBody += `---\n\n`;
202+
responseBody += `ℹ️ This response was generated automatically. `;
203+
responseBody += `If this doesn't fully answer your question or if you need further assistance, `;
204+
responseBody += `please mention \`@pwizla\` in a comment and a human maintainer will help you.\n\n`;
205+
responseBody += `You can also try our [interactive AI chat](https://docs.strapi.io) for more detailed assistance.\n\n`;
206+
responseBody += `💡 For feature requests or product feedback, visit [feedback.strapi.io](https://feedback.strapi.io).`;
207+
208+
// Post the response
209+
await github.rest.issues.createComment({
210+
owner: context.repo.owner,
211+
repo: context.repo.repo,
212+
issue_number: issueNumber,
213+
body: responseBody
214+
});
215+
216+
// Add labels based on enhanced content analysis
217+
const labels = [];
218+
const titleLower = issueTitle.toLowerCase();
219+
const bodyLower = issueBody.toLowerCase();
220+
const combinedContent = `${titleLower} ${bodyLower}`;
221+
222+
// Enhanced label detection
223+
if (combinedContent.includes('install') || combinedContent.includes('setup') || combinedContent.includes('getting started')) {
224+
labels.push('installation');
225+
}
226+
if (combinedContent.includes('deploy') || combinedContent.includes('production') || combinedContent.includes('hosting')) {
227+
labels.push('deployment');
228+
}
229+
if (combinedContent.includes('api') || combinedContent.includes('endpoint') || combinedContent.includes('rest') || combinedContent.includes('graphql')) {
230+
labels.push('api');
231+
}
232+
if (combinedContent.includes('plugin') || combinedContent.includes('extension')) {
233+
labels.push('plugins');
234+
}
235+
if (combinedContent.includes('documentation') || combinedContent.includes('docs') || titleLower.includes('[request]')) {
236+
labels.push('documentation');
237+
}
238+
if (combinedContent.includes('migration') || combinedContent.includes('upgrade') || combinedContent.includes('v4') || combinedContent.includes('v5')) {
239+
labels.push('migration');
240+
}
241+
if (combinedContent.includes('database') || combinedContent.includes('db') || combinedContent.includes('migration')) {
242+
labels.push('database');
243+
}
244+
if (combinedContent.includes('admin panel') || combinedContent.includes('admin') || combinedContent.includes('customization')) {
245+
labels.push('admin-panel');
246+
}
247+
if (combinedContent.includes('auth') || combinedContent.includes('permission') || combinedContent.includes('jwt') || combinedContent.includes('login')) {
248+
labels.push('authentication');
249+
}
250+
if (combinedContent.includes('i18n') || combinedContent.includes('locale') || combinedContent.includes('translation')) {
251+
labels.push('i18n');
252+
}
253+
if (combinedContent.includes('typo') || combinedContent.includes('error') || combinedContent.includes('bug') || combinedContent.includes('broken')) {
254+
labels.push('bug');
255+
}
256+
if (titleLower.includes('[request]') || combinedContent.includes('feature') || combinedContent.includes('enhancement')) {
257+
labels.push('enhancement');
258+
}
259+
if (titleLower.includes('[auto-sync]') || combinedContent.includes('automatic sync')) {
260+
labels.push('auto-sync');
261+
}
262+
263+
labels.push('auto-responded');
264+
265+
if (labels.length > 0) {
266+
await github.rest.issues.addLabels({
267+
owner: context.repo.owner,
268+
repo: context.repo.repo,
269+
issue_number: issueNumber,
270+
labels: labels
271+
});
272+
}
273+
274+
console.log(`Successfully processed issue #${issueNumber}`);
275+
276+
} catch (error) {
277+
console.error('Error calling Kapa AI:', error.message);
278+
if (error.response) {
279+
console.error(`HTTP Status: ${error.response.status}`);
280+
console.error('Response data:', error.response.data);
281+
}
282+
283+
// Fallback response - Fixed string concatenation
284+
let fallbackResponse = `👋 Hello @${issueAuthor}! Thanks for opening this issue.\n\n`;
285+
fallbackResponse += `🤖 I tried to analyze your question automatically but encountered a technical issue. `;
286+
fallbackResponse += `A human maintainer will review this soon.\n\n`;
287+
fallbackResponse += `In the meantime, you might find answers in our:\n`;
288+
fallbackResponse += `- [Documentation](https://docs.strapi.io)\n`;
289+
fallbackResponse += `- [Community Discord](https://discord.strapi.io)\n`;
290+
fallbackResponse += `- [Interactive AI chat](https://docs.strapi.io) (click "Ask AI")\n\n`;
291+
fallbackResponse += `@pwizla please review this issue.`;
292+
293+
await github.rest.issues.createComment({
294+
owner: context.repo.owner,
295+
repo: context.repo.repo,
296+
issue_number: issueNumber,
297+
body: fallbackResponse
298+
});
299+
300+
await github.rest.issues.addLabels({
301+
owner: context.repo.owner,
302+
repo: context.repo.repo,
303+
issue_number: issueNumber,
304+
labels: ['needs-review', 'auto-response-failed']
305+
});
306+
}
307+
env:
308+
KAPA_API_TOKEN: ${{ secrets.KAPA_API_TOKEN }}
309+
KAPA_PROJECT_ID: ${{ secrets.KAPA_PROJECT_ID }}

0 commit comments

Comments
 (0)