A complete Pull Request workflow: open a PR with a description, review the diff, add comments, approve it, and merge — with GitHub Actions running a basic check automatically.
What Is a Pull Request?
A Pull Request (PR) asks others to review and merge your branch. Even on solo projects, PRs create a paper trail of every change and why it was made. Many companies require them even for one-person changes.
A good PR has: a clear title, a description of what changed and why, a testing checklist, and links to related issues.
## What this PR does
Adds a /summarize endpoint to the FastAPI backend that calls Claude.
## Why
Users need to summarize long documents without copy-pasting to the Claude UI.
## Testing
- [ ] Unit test for summarize() passes
- [ ] Manual test with 1000-word document
- [ ] Error case: empty string returns 400
## Screenshots
[paste curl output here]Open a Pull Request via GitHub CLI
The GitHub CLI (gh) lets you open PRs from the terminal without switching to the browser. Install it with brew install gh, then authenticate with gh auth login.
# Install GitHub CLI
brew install gh
gh auth login
# Create and push your branch
git checkout -b feature/add-summarize-endpoint
# ... make changes and commit ...
git push -u origin feature/add-summarize-endpoint
# Open a PR
gh pr create --title "Add /summarize endpoint" --body "Adds Claude-powered document summarization. Tests passing." --base main
# View the PR status
gh pr status
# List all PRs
gh pr listGitHub Actions: Automate Your Checks
GitHub Actions runs code automatically on events like pull requests. Set up a simple CI check that runs your tests on every PR — you'll catch bugs before merging.
name: Run Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install deps
run: pip install -r requirements.txt
- name: Run tests
run: pytest tests/ -v
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}Add your API key as a secret: GitHub repo Settings > Secrets and variables > Actions > New repository secret. Name it ANTHROPIC_API_KEY.
Merge and Clean Up
After approval and passing checks, merge the PR. Then clean up the branch both locally and on GitHub.
# Merge the PR via CLI
gh pr merge --squash --delete-branch
# Update local main
git checkout main
git pull
# Delete local branch (already deleted on GitHub)
git branch -d feature/add-summarize-endpoint
# See your clean commit history
git log --oneline
# d7f8a9b Add /summarize endpoint
# a1b2c3d Initial project setup--squash combines all your branch commits into one clean commit on main. Keeps the history readable. Alternative: --merge for a merge commit or --rebase for linear history.
What You Learned Today
- Opened a Pull Request with a clear description and checklist
- Set up GitHub Actions to run tests automatically on every PR
- Merged a PR cleanly using squash merge
- Cleaned up local and remote branches after merging
Go Further on Your Own
- Add a linting step to your GitHub Actions workflow using flake8 or ruff
- Write your first pytest test for the summarize() function and watch it pass in CI
- Protect your main branch on GitHub: require PR reviews before merging
Nice work. Keep going.
Day 4 is ready when you are.
Continue to Day 4Want live instruction and hands-on projects? Join the AI bootcamp — 3 days, 5 cities.