GitHub Workflow Cheat Sheet

GitHub collaboration workflow — Pull Requests, code reviews, Issues, Projects, Actions CI/CD basics, and repository management.

Last Updated: May 1, 2025

Pull Requests

git push -u origin feature-branch
Push branch and set upstream before creating PR
gh pr create --title Title --body Description
Create a Pull Request via GitHub CLI
gh pr checkout 123
Check out a PR locally for review
gh pr diff 123
View the diff of a PR from the terminal
gh pr review 123 --approve
Approve a PR via GitHub CLI
gh pr review 123 --request-changes
Request changes on a PR
gh pr merge 123 --squash
Merge a PR with squash strategy
gh pr list --state open
List all open pull requests

Code Review Best Practices

ItemDescription
Draft PRsOpen PRs as drafts for early feedback, convert when ready
Small PRsKeep PRs under 400 lines — easier to review, fewer bugs
Review ChecklistDoes it work? Is it tested? Is it readable? Is it secure?
Inline SuggestionsUse GitHub's suggestion feature to propose exact code changes
CI Must PassConfigure branch protection to require CI checks before merge
Review in OrderReview commits individually for logical progression
Request Specific ReviewersAssign domain experts rather than broad teams
Respond to All CommentsAddress or discuss every review comment before merging

Issues & Projects

ItemDescription
LabelsUse consistent labels: bug, enhancement, documentation, good-first-issue
Issue TemplatesCreate .github/ISSUE_TEMPLATE/ for bug reports and feature requests
MilestonesGroup issues into milestones to track progress toward releases
Projects (Beta)Kanban boards for sprint planning and task management
Auto-close KeywordsInclude 'Fixes #123' in commit messages to auto-close issues
Issue FormsUse YAML issue forms for structured data collection
Task ListsUse - [ ] checkboxes to break issues into subtasks
AssigneesAssign issues to team members for clear ownership

GitHub Actions CI/CD

name: CI on: push
Basic workflow trigger — runs on every push
runs-on: ubuntu-latest
Specify runner OS for the job
actions/checkout@v4
Standard action to check out repository code
actions/setup-node@v4
Setup action for Node.js environment
npm test
Run test suite in CI pipeline
secrets.NPM_TOKEN
Access repository secrets in workflow files
on: pull_request
Trigger workflow on PR open, sync, or reopen
matrix: node-version: [16,18,20]
Test across multiple versions with matrix strategy
Pro Tip: Use Draft Pull Requests for early feedback. Switch to 'Ready for Review' when your code is complete — reviewers won't be notified until then.