This guide covers using GitHub CLI (gh) for streamlined issue management, pull request creation, and project board integration in the HMIS project.
# Windows (using winget)
winget install --id GitHub.cli
# Windows (using Chocolatey)
choco install gh
# macOS
brew install gh
# Linux (Ubuntu/Debian)
sudo apt install gh# Authenticate with GitHub
gh auth login
# Check authentication status
gh auth status# Basic issue creation
gh issue create --title "Bug: Login validation error" --body "Description of the issue"
# Interactive issue creation
gh issue create
# Create issue with labels and assignees
gh issue create --title "Feature: Add patient search" --label "enhancement,frontend" --assignee username
# Create issue from template
gh issue create --template bug_report.md# List all open issues
gh issue list
# List issues with filters
gh issue list --state closed --limit 10
gh issue list --author username
gh issue list --assignee @me
gh issue list --label bug
# View specific issue
gh issue view 12345
gh issue view 12345 --web # Open in browser# Close issue
gh issue close 12345
# Reopen issue
gh issue reopen 12345
# Add comment to issue
gh issue comment 12345 --body "Updated status information"
# Edit issue
gh issue edit 12345 --title "New title" --add-label priority-high# Create PR from current branch
gh pr create --title "Implement patient search feature" --body "Closes #12345"
# Interactive PR creation
gh pr create
# Create draft PR
gh pr create --draft --title "WIP: Patient search implementation"
# Create PR with reviewers and assignees
gh pr create --reviewer username1,username2 --assignee @me# List open PRs
gh pr list
# List PRs with filters
gh pr list --author username
gh pr list --state merged --limit 5
gh pr list --assignee @me
# View PR details
gh pr view 123
gh pr view 123 --web
# Check PR status
gh pr status# Merge PR (after approval)
gh pr merge 123 --merge # Create merge commit
gh pr merge 123 --squash # Squash and merge
gh pr merge 123 --rebase # Rebase and merge
# Close PR without merging
gh pr close 123
# Reopen PR
gh pr reopen 123
# Add review
gh pr review 123 --approve
gh pr review 123 --request-changes --body "Please fix the validation logic"
# Checkout PR locally
gh pr checkout 123# Add issue to project (requires project ID)
gh project item-add PROJECT_ID --url https://github.com/hmislk/hmis/issues/12345
# List project items
gh project list --owner hmislk# View workflow runs
gh run list
# View specific workflow run
gh run view 123456
# Rerun failed jobs
gh run rerun 123456
# Cancel workflow run
gh run cancel 123456# Create release
gh release create v1.2.0 --title "Version 1.2.0" --notes "Release notes here"
# List releases
gh release list
# View release
gh release view v1.2.0# Create feature issue that auto-links to project board
gh issue create \
--title "Feature: Implement fast sale for cashier" \
--body "## Description
Implement fast sale functionality for cashier module
## Acceptance Criteria
- [ ] Fast sale UI component
- [ ] Backend API integration
- [ ] Validation logic
- [ ] Error handling
## Related Issues
Related to #14268" \
--label "enhancement,cashier" \
--project "HMIS Development Board"# 1. Create issue-based branch
git checkout -b 14284-direct-purchase-cancel-bill
# 2. Make changes and commit
git add .
git commit -m "Implement direct purchase cancel functionality
Closes #14284"
# 3. Push branch
git push -u origin 14284-direct-purchase-cancel-bill
# 4. Create PR with auto-close
gh pr create \
--title "Direct purchase cancel bill #14284" \
--body "## Summary
Implements cancel functionality for direct purchase bills
## Changes
- Add cancel button to direct purchase interface
- Implement backend cancel logic
- Add validation for cancellation rules
- Update UI state management
## Testing
- [ ] Test cancel functionality
- [ ] Verify state updates
- [ ] Check validation rules
Closes #14284" \
--reviewer team-lead \
--assignee @me# Check your assigned issues
gh issue list --assignee @me --json number,title,state | jq '.[] | "\(.number): \(.title) (\(.state))"'
# Check PRs awaiting review
gh pr list --search "review-requested:@me"
# View recent activity
gh pr list --limit 5 --json number,title,updatedAt | jq '.[] | "\(.number): \(.title) (updated: \(.updatedAt))"'# Set default repo for commands
gh repo set-default hmislk/hmisAdd to your shell profile (.bashrc, .zshrc, etc.):
# Quick aliases for common operations
alias ghic='gh issue create'
alias ghil='gh issue list'
alias ghiv='gh issue view'
alias ghpc='gh pr create'
alias ghpl='gh pr list'
alias ghpv='gh pr view'
alias ghps='gh pr status'
# HMIS specific aliases
alias hmis-issues='gh issue list --repo hmislk/hmis'
alias hmis-prs='gh pr list --repo hmislk/hmis'
alias hmis-my-issues='gh issue list --repo hmislk/hmis --assignee @me'- Use descriptive titles: Include module/feature context
- Add appropriate labels: Use project-specific labels (frontend, backend, bug, enhancement)
- Link related issues: Reference other issues in descriptions
- Update project board: Ensure issues move through proper workflow states
- Follow naming convention: Use issue numbers in branch/PR titles
- Include closing keywords: Always use "Closes #issueNumber" in PR description
- Request appropriate reviewers: Tag relevant team members
- Update documentation: Link to relevant documentation changes
# Example commit with proper formatting
git commit -m "Fix OPD income report DTO implementation
- Add proper null handling for date fields
- Implement pagination for large datasets
- Fix boolean field mapping issues
Closes #14297"# Refresh authentication if commands fail
gh auth refresh
# Check repository permissions
gh repo view --json permissions
# Verify current repository context
gh repo view
# Debug API calls
gh api user --verbose- Permission denied: Check repository access and authentication
- Resource not found: Verify issue/PR numbers and repository context
- Rate limiting: Wait or authenticate to increase limits
# Create an issue for configuration file creation
gh issue create \
--title "Create gemini.md for Gemini agent configuration" \
--body "## Description
This commit creates the gemini.md file by combining the contents of CLAUDE.md and AGENTS.md. This file will provide the necessary configuration and guidelines for the Gemini agent.
## Tasks
- [ ] Combine CLAUDE.md and AGENTS.md contents
- [ ] Create gemini.md file with proper formatting
- [ ] Update cross-references in other configuration files
- [ ] Test configuration with Gemini agent
## Acceptance Criteria
- gemini.md file exists with complete configuration
- All guidelines from both source files are included
- File follows established documentation patterns
- Cross-references are updated appropriately
## Priority
Medium - Configuration standardization" \
--label "documentation,configuration" \
--assignee @me
# After creating, get the issue number for branch creation
gh issue list --limit 1 --json number,title# 1. Create issue (if not already created)
ISSUE_NUM=$(gh issue create \
--title "Fix OPD income report boolean handling" \
--body "Boolean fields in OPD income report are not displaying correctly" \
--label "bug,opd" \
--json number --jq '.number')
# 2. Create branch
git checkout -b ${ISSUE_NUM}-fix-opd-income-boolean-handling
# 3. Make changes, commit with proper message
git add .
git commit -m "Fix boolean field handling in OPD income report
- Add proper null checks for boolean fields
- Update DTO constructor to handle boolean conversion
- Fix display logic in report template
Closes #${ISSUE_NUM}"
# 4. Push branch
git push -u origin ${ISSUE_NUM}-fix-opd-income-boolean-handling
# 5. Create PR
gh pr create \
--title "Fix OPD income report boolean handling #${ISSUE_NUM}" \
--body "## Summary
Fixes boolean field display issues in OPD income reports
## Changes
- Updated DTO boolean field handling
- Added null safety checks
- Fixed template display logic
## Testing
- [ ] Test with null boolean values
- [ ] Verify report generation
- [ ] Check display formatting
Closes #${ISSUE_NUM}" \
--reviewer team-lead
# 6. Check PR status
gh pr status# List my open issues
gh issue list --assignee @me --state open
# Add comment to issue
gh issue comment 12345 --body "Working on implementation, will have PR ready by EOD"
# Close completed issue
gh issue close 12345 --comment "Completed in PR #456"
# Reopen if needed
gh issue reopen 12345 --comment "Reopening due to regression found in testing"This GitHub CLI usage integrates with:
- Persistence Configuration: Persistence Workflow
- Commit Conventions: Git Conventions
- Project Board Management: Project Board Integration
- Testing Workflow: Maven Commands
For more advanced usage, see the official GitHub CLI documentation.