Skip to content

Conversation

kenibrewer
Copy link
Member

Summary

This PR completely migrates the GitHub approval automation system from JavaScript/Node.js to Python with Click-based CLI interfaces.

Key Changes

  • Language Migration: Converted ApprovalManager class from JavaScript to Python using PyGithub library
  • Dependency Management: Replaced Node.js/npm with Python uv environment management
  • CLI Architecture: Implemented Click-based command-line interfaces for all three approval types:
    • SIG proposals: requires 2 core team approvals
    • RFC proposals: requires core team quorum (majority)
    • Pipeline proposals: requires 2 core team members OR 1 core + 1 maintainer
  • Testing: Migrated Jest test suite to pytest with comprehensive coverage (21/21 tests passing)
  • Workflows: Updated all GitHub Actions workflows to use Python scripts with CLI parameters
  • Configuration: Replaced package.json with modern pyproject.toml Python packaging
  • Documentation: Updated READMEs to reflect new Python-based system

Files Changed

Removed (JavaScript/Node.js):

  • approval.jsapproval.py
  • approval.test.jstest_approval.py
  • workflow-integration.test.js → integrated into pytest suite
  • package.json + package-lock.jsonpyproject.toml + uv.lock

Added (Python/Click):

  • approval.py - Core ApprovalManager class using PyGithub
  • scripts/ - Click CLI scripts for each proposal type
  • tests/ - Comprehensive pytest test suite
  • pyproject.toml - Modern Python package configuration

Updated:

  • All GitHub Actions workflow files to use Python CLI parameters
  • Root and lib README documentation
  • .gitignore for Python artifacts

Test Plan

  • All 21 pytest tests pass with 92% coverage
  • Real-world testing completed on issue Test RFC: Python Approval System #87
  • CLI scripts tested with actual GitHub API calls
  • GitHub Actions workflows validate successfully
  • Pre-commit hooks and linting pass

Breaking Changes

None - The automation functionality remains identical from an end-user perspective. Team members still use /approve and /reject commands exactly as before.

🤖 Generated with Claude Code

Copy link

github-actions bot commented Sep 26, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
97 89 92% 80% 🟢

New Files

File Coverage Status
.github/workflows/lib/approval.py 92% 🟢
TOTAL 92% 🟢

Modified Files

No covered modified files...

updated for commit: cb4227c by action🐍

@kenibrewer kenibrewer force-pushed the feat/python-automation-cli branch from 0f6d608 to 8a300be Compare September 26, 2025 13:20
…th Click CLI

- Convert ApprovalManager class from JavaScript to Python using PyGithub
- Replace Node.js dependencies with Python uv environment management
- Implement Click-based CLI interfaces for all three approval types:
  - SIG proposals: requires 2 core team approvals
  - RFC proposals: requires core team quorum
  - Pipeline proposals: requires 2 core OR 1 core + 1 maintainer
- Migrate Jest test suite to pytest with comprehensive coverage (21/21 tests)
- Update GitHub Actions workflows to use Python scripts with CLI parameters
- Replace package.json with pyproject.toml for modern Python packaging
- Update documentation to reflect Python-based automation system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@kenibrewer kenibrewer force-pushed the feat/python-automation-cli branch from 8a300be to f9f9125 Compare September 26, 2025 13:39
@kenibrewer kenibrewer changed the title ✨ feat: migrate approval automation from JavaScript to Python with Click CLI ♻️ refactor: migrate approval automation from JavaScript to Python with Click CLI Sep 26, 2025
│                                                                                                                               │
│   - Replace click dependency with rich-click for enhanced user experience                                                     │
│   - Update all CLI scripts to use rich_click as click import                                                                  │
│   - Makes @ewels happy                                                                                                       │
│
body += f"Current approvals: {len(approval_manager.core_approvals)}/{required_core_approvals}\n\n"

if approvers or rejecters or awaiting:
body += "|Review&nbsp;Status|Core Team members|\n|--|--|\n"
Copy link
Member

Choose a reason for hiding this comment

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

Missed a chance to use rich tables here! 😉

Comment on lines +6 to +7
sys.path.insert(0, str(Path(__file__).parent.parent))
from approval import ApprovalManager
Copy link
Member

Choose a reason for hiding this comment

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

Can't you just do this as a file path import?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants