- name
- GitHub Agentic Workflows Continuous AI Patterns
- description
- Comprehensive guide for continuous AI workflows including triage, review, maintenance, monitoring, scheduling strategies, event-driven automation, human-in-the-loop patterns, and feedback loops
- license
- Apache-2.0
- version
- 2.0.0
- last_updated
- 2026-04-02T00:00:00.000Z
- tags
- ["github-agentic-workflows","continuous-ai","workflow-patterns","automation","triage","code-review","maintenance","monitoring","scheduling","event-driven","human-in-the-loop","feedback-loops"]
# 🔄 GitHub Agentic Workflows Continuous AI Patterns
## 🔴 AI FIRST Quality Principle
> **Apply the AI FIRST principle: never accept first-pass quality. Minimum 2 iterations. Read all output, improve every section. No shortcuts.**
## 📋 Overview
This skill provides comprehensive patterns for implementing Continuous AI workflows with GitHub Agentic Workflows. Continuous AI extends CI/CD principles to AI-powered automation, enabling agents to continuously triage issues, review code, maintain repositories, and monitor systems with minimal human intervention.
### What is Continuous AI?
**Continuous AI** is the practice of deploying AI agents that run continuously or on regular schedules to perform repetitive tasks, monitor systems, and maintain code quality without manual intervention:
- **Continuous Triage**: Automatically label, prioritize, and route issues and PRs
- **Continuous Review**: Automated code reviews on every PR
- **Continuous Maintenance**: Dependency updates, security patches, code refactoring
- **Continuous Monitoring**: System health, performance metrics, security alerts
- **Feedback Loops**: Learn from outcomes and improve over time
### Why Continuous AI?
Traditional CI/CD focuses on build, test, and deploy. Continuous AI extends this to intelligent automation:
- ✅ **24/7 Operation**: Agents work around the clock
- ✅ **Instant Response**: No waiting for human availability
- ✅ **Consistency**: Same quality standards applied every time
- ✅ **Scalability**: Handle thousands of issues, PRs, and alerts
- ✅ **Cost Efficiency**: Reduce manual work and accelerate development
- ✅ **Knowledge Retention**: Agents learn from history and feedback
---
## 🎯 Continuous AI Concept
### The Continuous AI Loop
```
┌─────────────────────────────────────────────────────────────┐
│ CONTINUOUS AI LOOP │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. OBSERVE │
│ └─> Events (issues, PRs, commits, alerts) │
│ │
│ 2. ANALYZE │
│ └─> Context, patterns, history │
│ │
│ 3. DECIDE │
│ └─> Determine action (or escalate to human) │
│ │
│ 4. ACT │
│ └─> Execute action (label, review, fix) │
│ │
│ 5. LEARN │
│ └─> Collect feedback, update models │
│ │
│ 6. REPEAT │
│ └─> Back to OBSERVE │
│ │
└─────────────────────────────────────────────────────────────┘
```
### Continuous AI Principles
1. **Autonomy**: Agents make decisions independently within defined boundaries
2. **Observability**: All actions are logged and auditable
3. **Reversibility**: Actions can be undone if incorrect
4. **Human Oversight**: Critical decisions require human approval
5. **Continuous Learning**: Agents improve from feedback
6. **Graceful Degradation**: Fall back to safer behavior on uncertainty
---
## 🏷️ Continuous Triage Pattern
### Automatic Issue Labeling and Prioritization
```yaml
# .github/workflows/continuous-triage.yml
name: Continuous Issue Triage
on:
issues:
types: [opened, edited]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
permissions:
issues: write
contents: read
jobs:
triage-issues:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
- name: Triage New Issues
uses: github/copilot-agent@v1
with:
agent: triage-agent
task: |
Analyze and triage all issues:
1. Classify by type (bug, feature, docs, security)
2. Assign priority (P0-critical, P1-high, P2-medium, P3-low)
3. Apply relevant labels
4. Detect duplicates
5. Auto-assign to appropriate team/person
6. Add to project board
For security issues:
- Label as 'security'
- Set priority to P0
- Assign to security team
- Create private security advisory if needed
For bugs with reproduction steps:
- Label as 'bug'
- Add 'reproduction-provided' label
- Higher priority than bugs without reproduction
For feature requests:
- Label as 'enhancement'
- Check if duplicate of existing feature request
- Assign to product team for review
- name: Comment on Triaged Issues
run: |
gh issue comment ${{ github.event.issue.number }} \
--body "🤖 Issue automatically triaged by AI agent"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Triage Agent Implementation
```yaml
# .github/agents/triage-agent.yaml
---
name: triage-agent
description: Automatically triage issues and PRs
tools:
- github-issue_read
- github-issue_write
- github-search_issues
- github-projects_write
---
You are an expert issue triage agent. Your goal is to efficiently categorize, prioritize, and route issues to the appropriate teams.
## Classification Rules
### Issue Types
- **bug**: Runtime errors, crashes, incorrect behavior
- **enhancement**: New features or improvements
- **documentation**: Docs updates, typos, missing examples
- **security**: Vulnerabilities, CVEs, security concerns
- **performance**: Slow code, memory leaks, optimization
- **refactor**: Code cleanup, technical debt
- **ci**: CI/CD issues, workflow problems
- **dependencies**: Dependency updates, conflicts
### Priority Levels
- **P0-critical**: System down, data loss, security breach
- **P1-high**: Major functionality broken, security issue
- **P2-medium**: Feature broken, workaround exists
- **P3-low**: Minor bug, cosmetic issue, nice-to-have
### Priority Decision Matrix
```
┌──────────────────┬──────────┬──────────┬──────────┬──────────┐
│ Type / Impact │ Critical │ High │ Medium │ Low │
├──────────────────┼──────────┼──────────┼──────────┼──────────┤
│ Security │ P0 │ P0 │ P1 │ P2 │
│ Bug (prod) │ P0 │ P1 │ P2 │ P3 │
│ Bug (dev) │ P1 │ P2 │ P3 │ P3 │
│ Enhancement │ P1 │ P2 │ P3 │ P3 │
│ Documentation │ P2 │ P3 │ P3 │ P3 │
│ Refactor │ P2 │ P3 │ P3 │ P3 │
└──────────────────┴──────────┴──────────┴──────────┴──────────┘
```
## Triage Steps
1. **Read issue content**: Title, description, labels, comments
2. **Classify**: Determine issue type based on content
3. **Assess impact**: Production vs. dev, users affected
4. **Assign priority**: Use decision matrix
5. **Apply labels**: Type + priority + additional context labels
6. **Detect duplicates**: Search for similar issues
7. **Assign owner**: Route to appropriate team or person
8. **Add to project**: Place in correct project board column
## Special Handling
### Security Issues
- Immediately label as 'security'
- Set priority to P0 or P1
- Assign to security team
- If vulnerability disclosure, create security advisory
- Do NOT comment sensitive details publicly
### Duplicates
- Search for similar issues using keywords
- If found, comment with link and close as duplicate
- Transfer conversation to original issue
### Invalid Issues
- Missing reproduction steps for bugs → Request more info
- Spam or off-topic → Close with explanation
- Question (not issue) → Convert to discussion
## Examples
### Example 1: Security Issue
```
Issue: "SQL Injection in user login"
Classification: security
Priority: P0-critical
Labels: security, bug, P0-critical
Assigned: security-team
Action: Create security advisory
```
### Example 2: Feature Request
```
Issue: "Add dark mode support"
Classification: enhancement
Priority: P2-medium
Labels: enhancement, ui, P2-medium
Assigned: frontend-team
Action: Add to backlog project
```
### Example 3: Bug with Reproduction
```
Issue: "App crashes when clicking save button"
Classification: bug
Priority: P1-high (production impact)
Labels: bug, P1-high, reproduction-provided
Assigned: backend-team
Action: Add to current sprint
```
```
### Intelligent Duplicate Detection
```javascript
// duplicate-detector.js
class DuplicateDetector {
constructor(github) {
this.github = github;
}
async findDuplicates(issue) {
// Extract keywords from title and body
const keywords = this.extractKeywords(issue.title + ' ' + issue.body);
// Search for similar issues
const searchQuery = `repo:${issue.repository} is:issue ${keywords.join(' OR ')}`;
const { data: searchResults } = await this.github.search.issuesAndPullRequests({
q: searchQuery,
per_page: 10,
});
const candidates = searchResults.items.filter(
item => item.number !== issue.number
);
// Calculate similarity scores
const scored = candidates.map(candidate => ({
issue: candidate,
score: this.calculateSimilarity(issue, candidate),
}));
// Filter by similarity threshold
const duplicates = scored.filter(s => s.score > 0.7);
return duplicates.sort((a, b) => b.score - a.score);
}
extractKeywords(text) {
// Remove common words
const stopwords = new Set([
'the', 'a', 'an', 'in', 'on', 'at', 'to', 'for',
'is', 'was', 'are', 'were', 'be', 'been',
]);
// Tokenize and filter
const words = text.toLowerCase()
.replace(/[^\w\s]/g, ' ')
.split(/\s+/)
.filter(word => word.length > 3 && !stopwords.has(word));
// Get unique words
return [...new Set(words)];
}
calculateSimilarity(issue1, issue2) {
// Title similarity (weighted 60%)
const titleSim = this.jaccardSimilarity(
issue1.title.toLowerCase(),
issue2.title.toLowerCase()
);
// Body similarity (weighted 40%)
const bodySim = this.jaccardSimilarity(
issue1.body.toLowerCase(),
issue2.body.toLowerCase()
);
// Label similarity (bonus)
const labelSim = this.labelSimilarity(
issue1.labels,
issue2.labels
);
return (titleSim * 0.6 + bodySim * 0.4) * (1 + labelSim * 0.1);
}
jaccardSimilarity(str1, str2) {
const set1 = new Set(str1.split(/\s+/));
const set2 = new Set(str2.split(/\s+/));
const intersection = new Set([...set1].filter(x => set2.has(x)));
const union = new Set([...set1, ...set2]);
return intersection.size / union.size;
}
labelSimilarity(labels1, labels2) {
const set1 = new Set(labels1.map(l => l.name));
const set2 = new Set(labels2.map(l => l.name));
const intersection = new Set([...set1].filter(x => set2.has(x)));
const union = new Set([...set1, ...set2]);
return union.size > 0 ? intersection.size / union.size : 0;
}
}
```
---
## 👀 Continuous Review Pattern
### Automated Code Review on Every PR
```yaml
# .github/workflows/continuous-review.yml
name: Continuous Code Review
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Checkout PR
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: AI Code Review
uses: github/copilot-agent@v1
with:
agent: code-reviewer
task: |
Review pull request #${{ github.event.pull_request.number }}:
1. Code Quality:
- Check for code smells
- Identify potential bugs
- Suggest improvements
2. Security:
- Look for security vulnerabilities
- Check for hardcoded secrets
- Validate input sanitization
3. Performance:
- Identify inefficient algorithms
- Check for memory leaks
- Suggest optimizations
4. Best Practices:
- Ensure consistent style
- Check error handling
- Validate test coverage
5. Documentation:
- Verify docstrings
- Check README updates
- Ensure CHANGELOG entry
Provide specific, actionable feedback with code examples.
- name: Post Review Comments
uses: github/copilot-agent@v1
with:
agent: comment-poster
task: |
Post review comments on PR #${{ github.event.pull_request.number }}
using the feedback from the code review.
Use line-specific comments for code issues.
Use general comment for overall feedback.
```
### Progressive Review Pattern
```javascript
// progressive-review.js
class ProgressiveReviewer {
constructor() {
this.levels = [
{
name: 'quick-scan',
timeout: 30,
checks: [
'syntax-errors',
'obvious-bugs',
'security-critical',
],
},
{
name: 'standard-review',
timeout: 120,
checks: [
'code-quality',
'performance',
'best-practices',
'security',
],
},
{
name: 'deep-analysis',
timeout: 300,
checks: [
'architecture',
'design-patterns',
'edge-cases',
'maintainability',
],
},
];
}
async reviewPR(pr) {
const findings = [];
for (const level of this.levels) {
console.log(`Running ${level.name}...`);
try {
const levelFindings = await this.runLevel(level, pr);
findings.push(...levelFindings);
// Stop if critical issues found
if (this.hasCriticalIssues(levelFindings)) {
console.log('Critical issues found, stopping review');
break;
}
} catch (error) {
console.error(`Level ${level.name} failed:`, error);
break;
}
}
return this.consolidateFindings(findings);
}
async runLevel(level, pr) {
const findings = [];
for (const check of level.checks) {
const checkFindings = await this.runCheck(check, pr);
findings.push(...checkFindings);
}
return findings;
}
async runCheck(check, pr) {
// Implement specific check logic
switch (check) {
case 'syntax-errors':
return this.checkSyntax(pr);
case 'security-critical':
return this.checkSecurity(pr);
case 'code-quality':
return this.checkQuality(pr);
default:
return [];
}
}
View on GitHub