Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci-cd-maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: CI-CD Maintenance
on:
push:
branches: [ci-cd-maintenance]
pull_request:
branches: [main]
types: [opened, synchronize, reopened]

permissions:
contents: read
Expand All @@ -11,6 +14,8 @@ jobs:
validate-changes:
name: Validate CI-CD Changes
runs-on: ubuntu-latest
# Only run when the source branch is ci-cd-maintenance
if: github.head_ref == 'ci-cd-maintenance' || github.ref_name == 'ci-cd-maintenance'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
on:
pull_request:
types: [opened, synchronize, reopened]
branches-ignore: [ci-cd-maintenance]
workflow_run:
workflows: ["CI Quality Gates", "Test Suite", "Security", "Documentation CI"]
types: [completed]
Expand Down Expand Up @@ -222,7 +223,7 @@
run: |
# Check if there are performance benchmarks to compare
echo "performance_delta=No performance data" >> $GITHUB_OUTPUT
# TODO: Implement benchmark comparison when performance tests generate artifacts

Check notice on line 226 in .github/workflows/pr-summary.yml

View workflow job for this annotation

GitHub Actions / Code Issue Annotations

Found TODO/FIXME: # TODO: Implement benchmark comparison when performance tests generate artifacts

- name: Generate final comment
run: |
Expand Down
66 changes: 46 additions & 20 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ Use the `ci-cd-maintenance` branch and process when making changes to:
### CI/CD Maintenance Workflow

```python
async def update_cicd_infrastructure(changes_description):
async def update_cicd_infrastructure(changes_description, is_complex=False):
"""AI agent workflow for CI/CD changes."""

# 1. Create ci-cd-maintenance branch
Expand All @@ -552,39 +552,51 @@ async def update_cicd_infrastructure(changes_description):
# ... implement changes ...

# 3. Commit changes with clear description
commit_message = f"ci: {changes_description}\n\nRequires manual review and merge"
commit_message = f"ci: {changes_description}"
if is_complex:
commit_message += "\n\nRequires manual review and merge"
await run_command(f"git commit -m '{commit_message}'")

# 4. Push to trigger CI/CD maintenance workflow
await run_command("git push origin ci-cd-maintenance")

# 5. Wait for validation
validation_result = await wait_for_workflow("ci-cd-maintenance.yml")
# 5. Create PR for review
if is_complex:
return create_manual_review_pr(changes_description)
else:
return create_standard_cicd_pr(changes_description)

def create_standard_cicd_pr(changes_description):
"""Create standard CI/CD maintenance PR."""
return f"""
🔧 **CI/CD Maintenance: {changes_description}**

# 6. Create merge instructions
return generate_merge_instructions(validation_result)
**Type**: Standard workflow maintenance
**Auto-merge**: Safe for automatic merge after CI validation

**Changes**:
- {changes_description}

**Validation**: All CI checks must pass before merge
**Rollback**: Standard git revert if issues found
"""

def generate_merge_instructions(validation_result):
"""Generate clear instructions for manual merge."""
def create_manual_review_pr(changes_description):
"""Create complex CI/CD maintenance PR requiring manual review."""
return f"""
🔧 **CI/CD Maintenance Ready for Review**
🔧 **CI/CD Maintenance: {changes_description}**

**Validation Status**: {validation_result.status}
**Security Check**: {validation_result.security_status}
**Type**: Complex workflow changes requiring manual review
**Auto-merge**: DISABLED - Manual review required

**Manual Review Required**:
1. Review workflow changes carefully
2. Check for security implications
3. Verify no circular dependencies
4. Test rollback plan if needed

**To merge**:
```bash
git checkout main
git merge ci-cd-maintenance
git push origin main
git branch -d ci-cd-maintenance
```
**Changes**:
- {changes_description}

**Rollback plan** (if issues found after merge):
```bash
Expand Down Expand Up @@ -709,12 +721,26 @@ Please review and merge immediately.
"""
```

### When to Use Manual vs. Automatic Review

**Standard CI/CD changes (can be auto-merged after CI validation):**
- Coverage threshold adjustments (74% → 80%)
- Script bug fixes (analyze-version.py error handling)
- Dependency updates in workflows
- Minor workflow optimizations

**Complex CI/CD changes (require manual review):**
- New security workflows
- Permission changes
- Major workflow restructuring
- Infrastructure-as-code modifications

### Best Practices for AI Agents

1. **Always use ci-cd-maintenance branch** for workflow changes
2. **Never auto-merge CI/CD changes** - always require manual review
2. **Assess complexity** - standard changes can auto-merge, complex ones need manual review
3. **Validate thoroughly** before pushing changes
4. **Provide clear review instructions** for humans
4. **Provide clear categorization** (standard vs. complex) in PRs
5. **Plan rollback strategy** before making changes
6. **Monitor CI health** after changes are merged

Expand Down
Loading