> ## Documentation Index
> Fetch the complete documentation index at: https://orphelix.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Pull Requests

> Create and manage GitHub pull requests directly from Orphelix for GitOps workflow

## Overview

Orphelix integrates with GitHub to create and manage Pull Requests (PRs) directly from the dashboard. This enables a complete GitOps workflow where infrastructure changes go through code review before being applied to your cluster.

![Pull Requests](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/pull-requests.png)

## What are Pull Requests?

Pull Requests (PRs) are a GitHub feature for:

> [card] Code Review
>
> Team reviews changes before merging

> [card] Discussion
>
> Discuss changes, suggest improvements

> [card] CI/CD Integration
>
> Automated tests run on PR changes

> [card] Audit Trail
>
> Track who changed what and when

## Creating Pull Requests

### From YAML Editor

Most common method - edit manifests and create PR:

**1. Edit YAML**

Use YAML Editor to modify deployment/config

See [YAML Editor](https://orphelix.mintlify.site/user/github/yaml-editor.md) for details

**2. Review Changes**

Check diff to ensure changes are correct

![PR Diff](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/pr-diff.png)

**3. Add Commit Message**

Write clear, descriptive message:

```
Update API gateway to v2.1.0

- Bumps image from v2.0.0 to v2.1.0
- Adds rate limiting configuration
- Increases memory limit to handle higher load

Closes #456
```

**4. Select Target Branch**

Choose where to merge changes:

> [tab] Main/Master
>
> Default production branch
>
> Most common choice

> [tab] Staging
>
> Test in staging first
>
> Safer for large changes

> [tab] Custom
>
> Specific feature branch
>
> For multi-step deployments

**5. Create PR**

Click **"Create Pull Request"**

Orphelix:

1. Creates feature branch
2. Commits your changes
3. Opens PR on GitHub
4. Returns PR link

### Multi-file Pull Requests

Create PRs affecting multiple files:

![Multi-file PR](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/multi-file-pr.png)

**Use cases:**

* Update ConfigMap + Deployment (apply both changes together)
* Kustomize base + overlay modifications
* Coordinated changes across microservices

**1. Select Multiple Files**

In Repository Browser, select files with Ctrl+Click

**2. Edit Each File**

Make changes to all selected files

**3. Review All Changes**

Diff view shows all modified files

**4. Single Commit**

All changes in one commit, one PR

### From Repository Browser

Browse and edit repository files directly:

**1. Open Repo Browser**

Navigate to Repository Browser page

**2. Select Repository**

Choose GitHub repository from dropdown

**3. Browse Files**

Navigate file tree to find target file

**4. Edit File**

Click file, then Edit button

**5. Save and Create PR**

Save changes → Auto-creates PR

## PR Templates

Orphelix generates structured PR descriptions:

### Default Template

```markdown theme={null}
## 📦 Changes

Updated Kubernetes resources in namespace: `production`

### Modified Files
- `k8s/deployments/api-gateway.yaml`
- `k8s/configmaps/api-config.yaml`

### Changes Made

**Deployment: api-gateway**
- Updated image from `api:v2.0.0` to `api:v2.1.0`
- Increased memory limit from `512Mi` to `1Gi`
- Added CPU limit: `1000m`

**ConfigMap: api-config**
- Added `RATE_LIMIT_ENABLED=true`
- Updated `MAX_CONNECTIONS=1000`

### Testing Checklist
- [ ] Deploy to staging environment
- [ ] Verify application starts successfully
- [ ] Run integration tests
- [ ] Check resource utilization
- [ ] Validate rate limiting works
- [ ] Monitor error rates

### Rollback Plan
If issues occur:
1. Revert this PR
2. Scale down to 2 replicas
3. Investigate logs in staging

### Related Issues
Closes #456

---
🤖 Generated with [Orphelix](https://github.com/corapoid/orphelix)
```

### Custom Templates

Configure custom PR templates in your repository:

1. Create `.github/pull_request_template.md`
2. Orphelix uses it automatically
3. Override with custom message if needed

## Managing Pull Requests

### Viewing PRs

See all PRs created through Orphelix:

![PR List](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/pr-list.png)

**PR Information:**

* **Title**: PR description
* **Status**: Open, Merged, Closed
* **Author**: Who created PR
* **Created**: When PR was opened
* **Labels**: GitHub labels
* **Reviews**: Review status
* **Checks**: CI/CD status

### PR Status Indicators

> [accordion] Open
>
> **Color:** Blue
>
> **Meaning:** PR awaiting review/merge
>
> **Actions:**
>
> * Review changes
> * Request reviews
> * Merge when ready

> [accordion] Merged
>
> **Color:** Purple
>
> **Meaning:** PR successfully merged
>
> **Timeline:**
>
> * Changes now in target branch
> * ArgoCD/Flux will sync
> * Changes apply to cluster

> [accordion] Closed
>
> **Color:** Red
>
> **Meaning:** PR closed without merging
>
> **Reasons:**
>
> * Changes no longer needed
> * Superseded by another PR
> * Incorrect approach

> [accordion] Conflicts
>
> **Color:** Orange
>
> **Meaning:** Merge conflicts exist
>
> **Action required:**
>
> * Resolve conflicts on GitHub
> * Update branch from base
> * Push resolution

### Review Status

PRs show review state:

> [tab] Pending
>
> **Icon:** ⏳
>
> No reviews yet
>
> **Actions:**
>
> * Request reviews from team
> * Self-review if allowed

> [tab] Approved
>
> **Icon:** ✅
>
> Required approvals received
>
> **Actions:**
>
> * Merge PR
> * Wait for CI checks

> [tab] Changes Requested
>
> **Icon:** 🔄
>
> Reviewers requested modifications
>
> **Actions:**
>
> * Address feedback
> * Push new commits
> * Re-request review

> [tab] Commented
>
> **Icon:** 💬
>
> Comments but no approval/rejection
>
> **Actions:**
>
> * Respond to comments
> * Make suggested changes

### CI/CD Checks

View automated check status:

![PR Checks](https://mintlify.s3.us-west-1.amazonaws.com/orphelix/images/pr-checks.png)

**Common Checks:**

> [accordion] YAML Lint
>
> Validates YAML syntax
>
> **Pass:** ✅ Valid YAML
> **Fail:** ❌ Syntax errors

> [accordion] Policy Validation
>
> Checks against policies (OPA, Kyverno)
>
> **Pass:** ✅ Complies with policies
> **Fail:** ❌ Policy violations

> [accordion] Integration Tests
>
> Runs automated tests
>
> **Pass:** ✅ Tests passed
> **Fail:** ❌ Tests failed

> [accordion] Security Scan
>
> Scans for vulnerabilities
>
> **Pass:** ✅ No vulnerabilities
> **Fail:** ❌ Security issues found

## PR Actions

### Merging

Merge PR to apply changes:

**1. Ensure Approved**

Required reviews completed

**2. Check Status Checks**

All CI/CD checks passed

**3. Click Merge**

In GitHub or Orphelix PR view

**4. Select Merge Method**

> [tab] Merge Commit
>
> Creates merge commit (default)
>
> Preserves full history

> [tab] Squash & Merge
>
> Combines commits into one
>
> Cleaner history

> [tab] Rebase & Merge
>
> Replays commits on base
>
> Linear history

**5. Confirm Merge**

Changes merged to target branch

GitOps operator (ArgoCD/Flux) syncs changes

### Closing without Merging

Close PR if changes not needed:

**1. Add Comment**

Explain why closing:

```
Closing this PR as we decided to handle this in #789 instead
```

**2. Click Close**

PR closed but not deleted

**3. Optional: Delete Branch**

Clean up feature branch

### Updating PRs

Update PR with new commits:

> [tab] From Orphelix
>
> 1. Re-open YAML editor
> 2. Make additional changes
> 3. Save → Commits to same branch
> 4. PR automatically updates

> [tab] From Git
>
> ```bash theme={null}
> git checkout feature-branch
> git add .
> git commit -m "Address review feedback"
> git push origin feature-branch
> ```
>
> PR updates automatically

## GitOps Workflow

Complete deployment flow with PRs:

```mermaid theme={null}
graph LR
    A[Edit in Orphelix] --> B[Create PR]
    B --> C[Code Review]
    C --> D{Approved?}
    D -->|Yes| E[Merge PR]
    D -->|No| F[Update PR]
    F --> C
    E --> G[ArgoCD/Flux Syncs]
    G --> H[Applied to Cluster]
```

### Integration with GitOps Tools

> [tab] ArgoCD
>
> **Auto-sync on PR merge:**
>
> 1. PR merged to main
> 2. ArgoCD detects change
> 3. Compares with cluster state
> 4. Syncs new manifests
> 5. Updates deployment
>
> **ArgoCD App config:**
>
> ```yaml theme={null}
> apiVersion: argoproj.io/v1alpha1
> kind: Application
> spec:
>   syncPolicy:
>     automated:
>       prune: true
>       selfHeal: true
> ```

> [tab] Flux
>
> **GitRepository + Kustomization:**
>
> 1. PR merged to main
> 2. Flux polls repo (interval: 1m)
> 3. Detects new commit
> 4. Applies kustomization
> 5. Updates cluster
>
> **Flux config:**
>
> ```yaml theme={null}
> apiVersion: source.toolkit.fluxcd.io/v1
> kind: GitRepository
> metadata:
>   name: app-repo
> spec:
>   interval: 1m
>   url: https://github.com/org/repo
>   ref:
>     branch: main
> ```

> [tab] Manual
>
> **kubectl apply after merge:**
>
> 1. PR merged
> 2. CI/CD pipeline triggered
> 3. Runs kubectl apply
> 4. Changes deployed
>
> **GitHub Action:**
>
> ```yaml theme={null}
> - name: Deploy
>   run: |
>     kubectl apply -f k8s/
> ```

## Best Practices

> [accordion] Require Reviews
>
> Configure branch protection:
>
> ```
> Settings → Branches → Branch Protection Rules
> ✓ Require pull request reviews before merging
> ✓ Require review from Code Owners
> Number of required approvals: 2
> ```

> [accordion] Run CI Checks
>
> Automate validation:
>
> ```yaml theme={null}
> # .github/workflows/validate.yml
> name: Validate
> on: pull_request
> jobs:
>   lint:
>     runs-on: ubuntu-latest
>     steps:
>     - uses: actions/checkout@v3
>     - name: YAML Lint
>       run: yamllint k8s/
> ```

> [accordion] Use Semantic Commits
>
> Follow conventional commits:
>
> ```
> feat: Add rate limiting to API gateway
> fix: Correct memory limit causing OOMKills
> chore: Update nginx image to 1.21.6
> docs: Update deployment README
> ```

> [accordion] Link Issues
>
> Reference related issues:
>
> ```
> Closes #123
> Related to #456
> Fixes #789
> ```
>
> Auto-closes issues on merge

> [accordion] Test in Staging
>
> Deploy to staging before production:
>
> 1. Create PR to staging branch
> 2. Merge and test
> 3. Create PR from staging to main
> 4. Merge to production

> [accordion] Small PRs
>
> Keep PRs focused:
>
> ✅ One logical change per PR
> ❌ Multiple unrelated changes
>
> Easier to review and safer to merge

## Troubleshooting

### PR Creation Failed

**Symptom:** "Failed to create PR"

**Check:**

1. **Permissions**
   * Orphelix App has write access?
   * Repository not archived?

2. **Branch Conflicts**
   * Branch already exists?
   * Try different branch name

3. **GitHub API Limits**
   * Rate limit exceeded?
   * Wait 1 hour and retry

### Merge Conflicts

**Symptom:** PR shows conflicts

**Resolution:**

**1. View Conflicts**

Click "Resolve conflicts" on GitHub

**2. Choose Resolution**

> [tab] Accept Theirs
>
> Keep base branch version

> [tab] Accept Yours
>
> Keep PR branch version

> [tab] Manual Edit
>
> Combine both changes

**3. Mark Resolved**

Click "Mark as resolved"

**4. Commit Resolution**

Commit merge resolution

### CI Checks Failing

**Symptom:** PR blocked by failed checks

**Solutions:**

1. **Review Check Logs**
   * Click "Details" next to failed check
   * Read error messages
   * Fix issues

2. **Common Failures**
   * **YAML Lint**: Fix syntax errors
   * **Policy**: Adjust to meet policies
   * **Tests**: Fix broken tests
   * **Security**: Update vulnerable images

3. **Re-run Checks**
   * Push new commit
   * Or click "Re-run checks"

## Next Steps

> [card] [YAML Editor](https://orphelix.mintlify.site/user/github/yaml-editor.md)
>
> Learn about editing manifests

> [card] [GitHub Setup](https://orphelix.mintlify.site/user/github/github-app-setup.md)
>
> Configure GitHub integration

> [card] [Deployments](https://orphelix.mintlify.site/user/deployments.md)
>
> Back to deployments

> [card] [Repository Browser](https://orphelix.mintlify.site/user/repo-browser)
>
> Browse repository files


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.