|
| 1 | +# GitHub CLI Workflow Guide |
| 2 | + |
| 3 | +This guide documents the GitHub CLI (`gh`) commands we use in our development workflow. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [GitHub CLI](https://cli.github.com/) installed |
| 8 | +- Authenticated with `gh auth login` |
| 9 | +- Repository cloned locally |
| 10 | + |
| 11 | +## Issue Management |
| 12 | + |
| 13 | +### Create a New Issue |
| 14 | +```bash |
| 15 | +# Create a feature issue |
| 16 | +gh issue create \ |
| 17 | + --title "Feature: Your Feature Name" \ |
| 18 | + --body "# Feature Description |
| 19 | +
|
| 20 | +## Description |
| 21 | +Detailed description of the feature |
| 22 | +
|
| 23 | +## Features |
| 24 | +- [ ] Feature item 1 |
| 25 | +- [ ] Feature item 2 |
| 26 | +
|
| 27 | +## Benefits |
| 28 | +- Benefit 1 |
| 29 | +- Benefit 2 |
| 30 | +
|
| 31 | +## Technical Considerations |
| 32 | +- Technical point 1 |
| 33 | +- Technical point 2 |
| 34 | +
|
| 35 | +## Priority |
| 36 | +High/Medium/Low |
| 37 | +
|
| 38 | +## Labels |
| 39 | +enhancement, feature" |
| 40 | + |
| 41 | +# List issues |
| 42 | +gh issue list |
| 43 | + |
| 44 | +# View issue details |
| 45 | +gh issue view <issue-number> |
| 46 | +``` |
| 47 | + |
| 48 | +## Project Management |
| 49 | + |
| 50 | +### View Project |
| 51 | +```bash |
| 52 | +# List projects |
| 53 | +gh project list |
| 54 | + |
| 55 | +# View project items |
| 56 | +gh project item-list <project-number> |
| 57 | +``` |
| 58 | + |
| 59 | +## Release Management |
| 60 | + |
| 61 | +### Create a New Release |
| 62 | +```bash |
| 63 | +# Create and push a new tag |
| 64 | +git tag -a v1.x.x -m "Release message" |
| 65 | +git push origin v1.x.x |
| 66 | + |
| 67 | +# List releases |
| 68 | +gh release list |
| 69 | + |
| 70 | +# View release details |
| 71 | +gh release view v1.x.x |
| 72 | +``` |
| 73 | + |
| 74 | +## Repository Management |
| 75 | + |
| 76 | +### Clone Repository |
| 77 | +```bash |
| 78 | +gh repo clone PeterVinter/linux_docker_container_shutdown |
| 79 | +``` |
| 80 | + |
| 81 | +### View Repository |
| 82 | +```bash |
| 83 | +# View repository details |
| 84 | +gh repo view |
| 85 | + |
| 86 | +# View repository settings |
| 87 | +gh repo edit |
| 88 | +``` |
| 89 | + |
| 90 | +## Pull Request Workflow |
| 91 | + |
| 92 | +### Create Pull Request |
| 93 | +```bash |
| 94 | +# Create PR from current branch |
| 95 | +gh pr create \ |
| 96 | + --title "Feature: Your Feature Name" \ |
| 97 | + --body "Closes #<issue-number> |
| 98 | +
|
| 99 | +## Changes |
| 100 | +- Change 1 |
| 101 | +- Change 2 |
| 102 | +
|
| 103 | +## Testing |
| 104 | +- [ ] Test case 1 |
| 105 | +- [ ] Test case 2" |
| 106 | + |
| 107 | +# List pull requests |
| 108 | +gh pr list |
| 109 | + |
| 110 | +# Check out a pull request locally |
| 111 | +gh pr checkout <pr-number> |
| 112 | +``` |
| 113 | + |
| 114 | +## CI/CD Integration |
| 115 | + |
| 116 | +### View Workflow Runs |
| 117 | +```bash |
| 118 | +# List workflow runs |
| 119 | +gh run list |
| 120 | + |
| 121 | +# View specific workflow run |
| 122 | +gh run view <run-id> |
| 123 | + |
| 124 | +# Watch workflow run in real-time |
| 125 | +gh run watch <run-id> |
| 126 | +``` |
| 127 | + |
| 128 | +## Common Workflows |
| 129 | + |
| 130 | +### Feature Development Flow |
| 131 | +1. Create issue: |
| 132 | +```bash |
| 133 | +gh issue create --title "Feature: New Feature" --body "..." |
| 134 | +``` |
| 135 | + |
| 136 | +2. Create branch: |
| 137 | +```bash |
| 138 | +git checkout -b feature/new-feature |
| 139 | +``` |
| 140 | + |
| 141 | +3. Make changes and commit: |
| 142 | +```bash |
| 143 | +git add . |
| 144 | +git commit -m "feat: implement new feature" |
| 145 | +``` |
| 146 | + |
| 147 | +4. Create PR: |
| 148 | +```bash |
| 149 | +gh pr create --title "Feature: New Feature" --body "Closes #<issue-number>" |
| 150 | +``` |
| 151 | + |
| 152 | +### Release Flow |
| 153 | +1. Create release tag: |
| 154 | +```bash |
| 155 | +git tag -a v1.x.x -m "Release message" |
| 156 | +``` |
| 157 | + |
| 158 | +2. Push tag: |
| 159 | +```bash |
| 160 | +git push origin v1.x.x |
| 161 | +``` |
| 162 | + |
| 163 | +3. Verify release: |
| 164 | +```bash |
| 165 | +gh release view v1.x.x |
| 166 | +``` |
| 167 | + |
| 168 | +## Tips and Tricks |
| 169 | + |
| 170 | +### Aliases |
| 171 | +Add these to your `.gitconfig`: |
| 172 | +```ini |
| 173 | +[alias] |
| 174 | + ic = "!gh issue create" |
| 175 | + il = "!gh issue list" |
| 176 | + prc = "!gh pr create" |
| 177 | + prl = "!gh pr list" |
| 178 | +``` |
| 179 | + |
| 180 | +### Environment Variables |
| 181 | +```bash |
| 182 | +# Set default editor |
| 183 | +export GH_EDITOR=vim |
| 184 | + |
| 185 | +# Set default browser |
| 186 | +export GH_BROWSER=firefox |
| 187 | +``` |
| 188 | + |
| 189 | +## Troubleshooting |
| 190 | + |
| 191 | +### Authentication Issues |
| 192 | +```bash |
| 193 | +# Re-authenticate |
| 194 | +gh auth login |
| 195 | + |
| 196 | +# Check auth status |
| 197 | +gh auth status |
| 198 | +``` |
| 199 | + |
| 200 | +### API Rate Limiting |
| 201 | +```bash |
| 202 | +# Check API rate limits |
| 203 | +gh api rate_limit |
| 204 | +``` |
0 commit comments