Dependify automatically creates professional pull requests with AI-generated changelogs that explain what changed, why it changed, and the confidence level of each modification. The PR descriptions follow GitButler’s detailed format, providing reviewers with comprehensive context.
Dependify automatically determines if a fork is needed:
git_driver.py:11-26
def create_fork(repo_owner, repo_name): """ Create a TEMPORARY STAGING fork of the repository for PR creation. If the user already owns the repo, returns the original repo info (no fork needed). If fork already exists, returns the existing fork information. """ headers = { "Authorization": f"token {Config.GITHUB_TOKEN}", "Accept": "application/vnd.github.v3+json" } # Get authenticated user's username user_response = requests.get( "https://api.github.com/user", headers=headers )
Own Repository
External Repository
When user owns the repo:
git_driver.py:42-51
if username.lower() == repo_owner.lower(): print(f"User owns the repository - no fork needed") repo_response = requests.get( f"https://api.github.com/repos/{repo_owner}/{repo_name}", headers=headers ) if repo_response.status_code == 200: repo_data = repo_response.json() repo_data['is_own_repo'] = True return repo_data
Result: PR created directly in the repository (no fork)
Dependify includes a sophisticated changelog generation system:
changelog_formatter.py:363-430
def generate_pr_description(file_changes: List[FileChange]) -> str: """ Generate a detailed, professional PR description similar to GitButler style. Shows what changed, why it changed, and the impact. """ total_files = len(file_changes) # Calculate accurate diff stats total_added = 0 total_removed = 0 for fc in file_changes: added, removed = ChangelogFormatter.calculate_diff_stats( fc.old_code, fc.new_code ) total_added += added total_removed += removed pr_desc = [] pr_desc.append("## 🤖 Automated Code Modernization\n") pr_desc.append("This pull request modernizes outdated code patterns and updates deprecated syntax to current best practices.\n")
## 🤖 Automated Code ModernizationThis pull request modernizes outdated code patterns and updates deprecated syntax to current best practices.### 📝 SummaryUpdated **5 files** with modern syntax and improved code quality.### 📁 Changes by File#### 1. `src/components/Header.tsx`**What changed:**- Converted to functional component- Added TypeScript types- Added async/await**Why:**> Functional components are the current React best practice and enable better use of hooks.> TypeScript types improve code safety and IDE support.---#### 2. `src/utils/api.js`**What changed:**- Added async/await- Improved error handling patterns**Why:**> Updated to use modern async/await syntax instead of promise chaining.> This improves readability and makes error handling cleaner.---
def create_pull_request( new_branch_name, repo_owner, repo_name, base_branch, head_owner, is_own_repo=False, changelog_markdown=None): pr_title = f"🤖 Automated code modernization by Dependify" # Use provided changelog or default PR body if changelog_markdown: pr_body = changelog_markdown headers = { "Authorization": f"token {Config.GITHUB_TOKEN}", "Accept": "application/vnd.github.v3+json" } # If it's user's own repo, head is just the branch name # If it's a fork, head is "username:branch_name" if is_own_repo: head = new_branch_name else: head = f"{head_owner}:{new_branch_name}" data = { "title": pr_title, "head": head, "base": base_branch, "body": pr_body } url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/pulls" response = requests.post(url, json=data, headers=headers)
pr_body = f"""## Automated Code ModernizationThis pull request was automatically generated by [Dependify](https://github.com/kshitizz36/Dependify2.0) to modernize outdated syntax and improve code quality.### Changes Made- Updated outdated syntax to modern standards- Improved code readability and maintainability- Applied best practices and conventions### Review Guidelines- Please review all changes carefully before merging- Run your test suite to ensure compatibility- Check for any breaking changes in updated APIs### Branch`{new_branch_name}`---Generated with ❤️ by [Dependify 2.0](https://github.com/kshitizz36/Dependify2.0)"""
git_driver.py:227-255
pr_body = f"""## Automated Code Modernization### About This PR- This PR was created from a **temporary staging fork** (`{head_owner}/{repo_name}`)- The fork was created solely to propose these changes- You can safely delete the fork after reviewing/merging this PR- All changes are transparent and can be reviewed in the "Files changed" tab### Branch`{new_branch_name}` (from fork: `{head_owner}/{repo_name}`)---Generated with ❤️ by [Dependify 2.0](https://github.com/kshitizz36/Dependify2.0)*Note: This is an automated tool for code modernization. The temporary fork used to create this PR can be deleted after the PR is merged or closed.*"""
pr_desc.append("### ✅ Review Checklist\n")pr_desc.append("- [ ] Review the changes in each file")pr_desc.append("- [ ] Verify the modernized syntax is correct")pr_desc.append("- [ ] Run tests to ensure no breaking changes")pr_desc.append("- [ ] Check for any deprecated API usage\n")
Always review generated PRs before merging. While Dependify validates syntax, semantic correctness requires human verification.
response_data = { "status": "success", "message": "Repository updated and pull request created successfully", "repository": payload.repository, "files_analyzed": len(job_list), "files_updated": len(files_changed), "branch": new_branch_name, "pull_request_url": pr_url, "is_own_repo": is_own_repo, "quality_metrics": { "average_confidence_score": round(total_confidence, 1), "all_files_validated": all_valid, "high_confidence_files": high_confidence_count }}# Add fork information if it was forkedif not is_own_repo: response_data["fork_info"] = { "message": "A temporary staging fork was created to propose these changes", "fork_owner": username, "fork_name": repo_name, "can_delete": True, "delete_note": "You can safely delete this fork after the PR is merged or closed" }