Skip to content

Kdf/auto issues#572

Merged
gcharang merged 19 commits intodevfrom
kdf/auto-issues
Nov 11, 2025
Merged

Kdf/auto issues#572
gcharang merged 19 commits intodevfrom
kdf/auto-issues

Conversation

@smk762
Copy link
Contributor

@smk762 smk762 commented Aug 13, 2025

Example issues created from this workflow: https://github.com/KomodoPlatform/komodo-docs-mdx/issues?q=is%3Aissue%20state%3Aopen%20label%3Aauto-generated

Source KDF PR: GLEECBTC/komodo-defi-framework#2587

AI generated drafts initial implementation: #574
AI generated drafts enhancements issue: #592

Generated doc for consolidate_utxos: https://github.com/KomodoPlatform/komodo-docs-mdx/blob/598859a8fbd734e7e7e8150554e8589193b2ccc1/src/pages/komodo-defi-framework/api/legacy/consolidate_utxos/index.mdx


🤖 Automated Documentation Issue Creation from KDF PRs

This PR introduces an automated workflow that monitors the komodo-defi-framework repository for PRs labeled with "status: pending docs" and automatically creates corresponding documentation issues in this repository.

🎯 What This Solves

  • Manual Documentation Tracking: No more manually creating issues for each PR that needs documentation
  • Missed Documentation: Ensures no PR requiring docs is forgotten
  • Context Loss: Preserves PR context and file changes for documentation teams
  • Workflow Efficiency: Automated daily synchronization with smart deduplication

🚀 Key Features

📅 Automated Scheduling

  • Runs daily at 3:13 AM UTC via cron schedule
  • Processes all open PRs with "status: pending docs" label
  • Smart deduplication - won't create duplicate issues

🎛️ Manual Control

  • Manual trigger via GitHub Actions UI with options:
    • Dry Run Mode: Test without creating real issues
    • Specific PRs: Target specific PR numbers for processing
  • Flexible execution for testing and one-off runs

🤖 AI-Enhanced Summaries (Optional)

  • Integrates with OpenAI API for AI-generated PR summaries
  • Focuses on documentation-relevant changes (RPC methods, parameters, breaking changes)
  • Gracefully falls back if API unavailable - core functionality always works

🛡️ Production-Ready Features

  • Rate Limiting: Built-in GitHub API throttling and retry logic
  • Error Handling: Continues processing other PRs if individual ones fail
  • Security: Minimal permissions with explicit token scoping
  • Monitoring: Comprehensive logging and workflow summaries
  • Performance: Concurrent processing with safety limits

📋 Generated Issues Include

Each created documentation issue contains:

  • Source PR Information: Direct links and author details
  • AI Summary: Focused on documentation requirements (if OpenAI key provided)
  • Suggested Tasks: Structured checklist for documentation work
  • File Changes: Complete list of modified files for scoping
  • Automatic Labels: docs-needed and auto-generated for organization

🔧 Implementation Details

Architecture

  • Main Workflow: .github/workflows/scan_kdf_pulls_clean.yml
  • Core Logic: .github/scripts/sync-docs-issues.js
  • Dependencies: Minimal Node.js dependencies with proper caching

Configuration

  • Source Repository: KomodoPlatform/komodo-defi-framework
  • Target Repository: KomodoPlatform/komodo-docs-mdx
  • Trigger Label: "status: pending docs"
  • Labels Applied: ["docs-needed", "auto-generated"]

Setup Requirements

  • No setup required - Uses automatic GITHUB_TOKEN
  • 🔧 Optional: Add OPENAI_API_KEY secret for AI summaries (~$1-5/month)

🧪 Testing & Validation

The workflow includes comprehensive testing capabilities:

  • Dry Run Mode: Safe testing without creating real issues
  • Specific PR Processing: Target individual PRs for validation
  • Manual Triggers: Full control over execution timing
  • Detailed Logging: Clear visibility into processing results

📊 Expected Impact

For Documentation Team

  • Automated Issue Creation: No manual tracking needed
  • Rich Context: AI summaries and complete file listings
  • Structured Workflow: Consistent issue format with task checklists

For Development Team

  • Zero Overhead: Just add the label to PRs needing docs
  • Clear Visibility: Automatic tracking of documentation requirements
  • Improved Handoff: Better context transfer to documentation team

🔒 Security & Best Practices

  • Minimal Permissions: Only required GitHub API access
  • Rate Limiting: Respects GitHub API limits with built-in throttling
  • Error Isolation: Failures don't affect other processing
  • Token Security: Uses GitHub's automatic token with optional OpenAI API
  • Audit Trail: Complete logging of all actions

🎛️ Usage

Automatic (Recommended)

  1. Label any PR in komodo-defi-framework with "status: pending docs"
  2. Wait for next daily run (3:13 AM UTC)
  3. Documentation issue automatically created in this repository

Manual Trigger

  1. Go to Actions → "Sync docs issues from framework PRs"
  2. Click "Run workflow"
  3. Choose options:
    • dry_run: false for real issues, true for testing
    • pr_numbers: Leave empty for all, or specify like "123,456"

AI Summaries (Optional)

  1. Add OPENAI_API_KEY repository secret
  2. AI summaries automatically included in future issues
  3. Cost: ~$1-5/month for typical usage

🔄 Future Enhancements

This foundation enables future improvements:

  • Real-time webhooks for instant issue creation
  • Customizable issue templates per project area
  • Integration with project management tools
  • Enhanced AI prompts for specific documentation types

This workflow significantly improves our documentation process automation while maintaining full control and transparency. It's production-ready and designed to handle the scale and complexity of the Komodo Platform development workflow.

@smk762 smk762 marked this pull request as draft August 13, 2025 05:48
@github-actions
Copy link

github-actions bot commented Aug 13, 2025

Documentation Preview Links

Preview for commit: 504463d
Base URL: https://7aafe4f1.komodo-docs.pages.dev/en/docs

Changed Documentation Files

Commit: 504463d - Merge branch 'dev' into kdf/auto-issues

smk762 added 4 commits August 14, 2025 15:13
…orkflow

- Add AI_AGENT_REFERENCE_GUIDE.md explaining auto-generation principles
- Update auto-PR scripts to follow proper build process
- Ensure auto-generated files (index.mdx, filepathSlugs.json) are not committed
- Add build validation to workflow
- Include detailed documentation structure requirements
- Add proper {{label}} attribute requirements for script parsing
Major improvements to the auto-documentation generation process:

SYNC SCRIPT ENHANCEMENTS:
• Extract JSON code blocks from PR descriptions automatically
• Parse request parameters and types from real examples
• Derive method information from actual implementation code
• Generate structured issue content with parameter details
• Handle template variables ({{userpass}}) in JSON examples

AUTO-PR SCRIPT ENHANCEMENTS:
• Parse structured method information from enhanced issues
• Use real parameter examples in generated documentation
• Include extracted parameter details in documentation
• Generate realistic request examples from source PR data
• Improved template with actual method descriptions

WORKFLOW IMPROVEMENTS:
• End-to-end validation with build test integration
• Proper {{label}} attribute handling for script parsing
• CompactTable component integration for API documentation
• Enhanced AI prompts with structured information context

EXAMPLE WITH PR #2587:
• Automatically extracts consolidate_utxos method details
• Parses coin and merge_conditions parameters with types
• Generates documentation with real JSON examples
• Includes parameter structure: merge_at (integer), max_merge_at_once (integer)

This addresses the need to capture actual code examples from PRs like
komodo-defi-framework#2587 and use them to generate accurate API documentation
instead of generic templates.
initial workflow for AI generated drafts
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive automated documentation workflow system that bridges the Komodo DeFi Framework (KDF) repository with the documentation repository, creating a two-stage automation pipeline for documentation updates.

Key changes:

  • Automated issue creation from KDF PRs labeled "status: pending docs"
  • Automated PR creation from issues labeled "ai-draft-pr"
  • New consolidate_utxos RPC method documentation with examples and usage guide

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/pages/komodo-defi-framework/changelog/index.mdx Added v2.6.0-beta changelog entry documenting the new UTXO consolidation feature
src/pages/komodo-defi-framework/api/legacy/consolidate_utxos/index.mdx Complete documentation for the new consolidate_utxos RPC method including parameters, responses, and examples
src/pages/komodo-defi-framework/api/index.mdx Added consolidate_utxos method to the main API methods table
src/data/sidebar.json Added navigation entry for the new consolidate_utxos documentation page
AI_AGENT_REFERENCE_GUIDE.md Comprehensive guide for AI agents documenting KDF API methods, including file structure requirements and build process
.github/workflows/scan_kdf_pulls_clean.yml Workflow that scans KDF PRs daily and creates documentation issues with AI-enhanced summaries
.github/workflows/auto-pr-from-issues.yml Workflow that processes labeled issues and automatically creates PRs with generated documentation
.github/scripts/sync-docs-issues.js Core logic for scanning KDF PRs, extracting method information, and creating documentation issues
.github/scripts/auto-pr-from-issues.js Core logic for parsing issues, generating documentation files, and creating pull requests
.github/package.json Node.js dependencies for the automation workflows (Octokit, retry/throttling plugins, node-fetch)
.github/package-lock.json Locked dependency versions ensuring consistent workflow execution
.github/AUTO_PR_WORKFLOW.md Documentation explaining the auto-PR workflow, configuration, and usage patterns
Files not reviewed (1)
  • .github/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Nov 11, 2025

@gcharang I've opened a new pull request, #595, to work on those changes. Once the pull request is ready, I'll request review from you.

@gcharang gcharang merged commit 458943c into dev Nov 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants