GitHub Pull Request Integration¶
The SecAI SonarQube plugin includes GitHub integration that allows users to automatically create pull requests with code fixes directly from the plugin interface. This feature is available in both the AIFix and Quick Fix components.
For details on the setup, configuration and usage refer to the user guide.
Technical Implementation¶
Core Components¶
GitHub API Integration¶
Both components use the Octokit library for GitHub API interactions:
Pull Request Creation Flow¶
- Branch Creation: Creates a new branch with a unique name based on the issue
- File Update: Updates the target file with the fixed code
- Pull Request: Creates a PR with descriptive title and body
- User Feedback: Displays success message with PR link
API Endpoints Used¶
GET /repos/{owner}/{repo}/contents/{path}- Fetch file contentPUT /repos/{owner}/{repo}/contents/{path}- Update file contentPOST /repos/{owner}/{repo}/pulls- Create pull request