An AI-driven GitHub Action for automated code review, security auditing, and intelligent issue tracking utilizing the OpenAI GPT-4o API.
- Features
- Tech Stack & Architecture
- Getting Started
- Testing
- Deployment
- Usage
- Configuration
- License
- Support the Project
- Automated Diff Analysis: Extracts and parses code patches from Git pushes and Pull Requests.
- Intelligent Labeling: Automatically assigns relevant tags (e.g.,
bug,enhancement,security) based on context. - Security Auditing: Scans patches for hardcoded secrets, injection flaws, and XSS vulnerabilities, appending a
Security Warningto the issue body. - Dual Trigger Support: Seamlessly handles both standard branch pushes and PR synchronization events without duplicating issues.
- Identity Verification: Executes workflows exclusively for the designated repository owner to prevent unauthorized API usage.
- Language: Python 3.11
- Orchestration: GitHub Actions (IssueOps pattern)
- Libraries:
PyGithub(for GitHub REST API interactions),openai(for OpenAI API communication) - LLM Provider: OpenAI API (
gpt-4omodel)
The architecture follows a decoupled IssueOps model. The .yml file handles environment provisioning and CI/CD triggers, while the state-agnostic Python script manages logic.
.github/workflows/ai-issue.yml: CI/CD pipeline definition. Injects secrets as environment variables.process_event.py: Core logic runner. Uses the official OpenAI Python SDK to communicate with the GPT-4o model.
- A GitHub repository with GitHub Actions enabled.
- An OpenAI API key.
-
Clone your repository:
git clone https://github.com/OstinUA/your-repo.git cd your-repo -
Create the GitHub Action workflow file
.github/workflows/ai-issue.ymland paste the provided YAML configuration. -
Create
process_event.pyin the root directory and paste the provided Python script. -
Commit and push the files to your
mainbranch:git add . git commit -m "chore: setup gpt-4o auto-issue generator" git push origin main
To test the integration locally or trigger a dry-run:
- Create a dummy branch:
git checkout -b test-ai-action - Introduce a deliberate flaw (e.g.,
const API_KEY = "12345";). - Push the branch and open a Pull Request to
main. - Monitor the Actions tab to verify successful execution and issue generation.
Deployment is handled automatically via GitHub Actions upon pushing the .yml configuration to the default branch. Ensure that repository workflow permissions are set to Read and write permissions.
The system operates autonomously in the background.
- For Pushes: Push commits directly to
main. An issue will be generated documenting the changes. - For PRs: Open or synchronize a Pull Request. The action will analyze the entire PR diff and generate a summary issue.
Configure the following Repository Secrets via Settings -> Secrets and variables -> Actions:
OPENAI_API_KEY: Your OpenAI API key from https://platform.openai.com/api-keys.ALLOWED_USER: Your exact GitHub handle (e.g.,OstinUA).
Distributed under the MIT License. See LICENSE for more information.
If you find this tool useful, consider leaving a star on GitHub or supporting the author directly.