|
| 1 | +--- |
| 2 | +title: "Version-Controlling GitHub Issue Workflows: A Practical Approach" |
| 3 | +slug: version-controlling-github-issue-workflows-a-practical-approach |
| 4 | +description: "GitHub issues lack inherent structure. I built do-gh-sub-issues to bring hierarchy and better workflow control across multiple projects." |
| 5 | +date: 2025-07-24 |
| 6 | +tags: |
| 7 | + - GitHub |
| 8 | + - Git |
| 9 | + - AI |
| 10 | +categories: |
| 11 | + - Software Development |
| 12 | +thumbnail: |
| 13 | + url: /img/blog/github-issues-overview.png |
| 14 | +draft: true |
| 15 | +--- |
| 16 | + |
| 17 | +## Building GitHub Issue Hierarchies: A Practical Approach |
| 18 | + |
| 19 | +After struggling with GitHub's flat issue structure across multiple projects, I created a solution that brings hierarchical organization to issue tracking. Here's how I built do-gh-sub-issues as a simple yet powerful workflow tool. |
| 20 | + |
| 21 | +## The Core Problem |
| 22 | + |
| 23 | +During a recent project, I discovered three critical pain points in GitHub's native issue management: |
| 24 | + |
| 25 | + 1. No validation for parent-child relationships between issues |
| 26 | + 2. Manual status synchronization across dependent tasks |
| 27 | + 3. Missing audit trail for workflow changes |
| 28 | + |
| 29 | +This led to several incidents where completed features had unresolved dependencies, prompting me to create a code-based solution. |
| 30 | + |
| 31 | +{{< image src="/img/blog/github-issue-with-sub-issue.png" mode="true" caption="demonstrating parent-child relationships" >}} |
| 32 | + |
| 33 | +## Why Start with .sh? |
| 34 | + |
| 35 | +I chose Bash scripting for the initial implementation because: |
| 36 | + |
| 37 | +**Universal Availability**: Every Unix-like system has a shell interpreter |
| 38 | +**Minimal Dependencies**: No package managers or runtime environments needed |
| 39 | +**Rapid Prototyping**: Immediate feedback during development |
| 40 | +**Educational Value**: Clear, readable code for learning purposes |
| 41 | +The script handles: |
| 42 | + |
| 43 | +```bash |
| 44 | +- Issue relationship validation |
| 45 | +- Status cascade logic |
| 46 | +- Cross-reference checking |
| 47 | +- CI/CD integration |
| 48 | +``` |
| 49 | + |
| 50 | +## Technical Implementation |
| 51 | + |
| 52 | +### Configuration Setup |
| 53 | + |
| 54 | +I define relationships in `.github/issue-workflow.yml`: |
| 55 | + |
| 56 | +```yaml |
| 57 | +# Core workflow rules |
| 58 | +version: 2024.1 |
| 59 | + |
| 60 | +workflows: |
| 61 | + feature_development: |
| 62 | + parent_prefix: "Epic:" |
| 63 | + child_types: |
| 64 | + - prefix: "Task:" |
| 65 | + required: true |
| 66 | + status_map: |
| 67 | + "In Progress": "Active" |
| 68 | + "Done": "Needs Review" |
| 69 | + - prefix: "Research:" |
| 70 | + blocking: false |
| 71 | + |
| 72 | + documentation: |
| 73 | + parent_prefix: "Docs:" |
| 74 | + auto_close: true |
| 75 | + status_cascade: true |
| 76 | +``` |
| 77 | +
|
| 78 | +### CI Validation |
| 79 | +
|
| 80 | +The GitHub Action enforces these rules on every PR: |
| 81 | +
|
| 82 | +```yaml |
| 83 | +name: Issue Workflow Validation |
| 84 | +on: [pull_request, issues] |
| 85 | + |
| 86 | +jobs: |
| 87 | + validate_issues: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - name: Check issue dependencies |
| 92 | + uses: d-oit/gh-sub-issues@v2 |
| 93 | + with: |
| 94 | + config_path: .github/issue-workflow.yml |
| 95 | + validation_mode: strict |
| 96 | +``` |
| 97 | +
|
| 98 | +Key validation features: |
| 99 | +
|
| 100 | +- Blocks PRs with incomplete dependencies |
| 101 | +- Enforces status transition rules |
| 102 | +- Verifies correct issue type prefixes |
| 103 | +- Generates visual dependency graphs |
| 104 | +
|
| 105 | +### Workflow Visualization |
| 106 | +
|
| 107 | +```mermaid |
| 108 | +graph TD |
| 109 | + PR[Pull Request] -->|Triggers| Validator |
| 110 | + Validator -->|Reads| Config[issue-workflow.yml] |
| 111 | + Validator -->|Checks| Issues[Linked Issues] |
| 112 | + Issues -->|Valid| CI_Pass[CI Passes] |
| 113 | + Issues -->|Invalid| CI_Fail[CI Fails] |
| 114 | + CI_Fail -->|Reports| Error[Specific Validation Errors] |
| 115 | +``` |
| 116 | + |
| 117 | +## Practical Benefits |
| 118 | + |
| 119 | +Through regular use, I've observed: |
| 120 | + |
| 121 | +1. **Reduced Oversights**: Automated checks prevent merging with unresolved dependencies |
| 122 | +2. **Clearer Context**: Version-controlled workflow definitions serve as documentation |
| 123 | +3. **Consistent Processes**: Status transitions follow codified rules across all repos |
| 124 | +4. **Adaptable Workflows**: Configuration changes through standard PR review process |
| 125 | + |
| 126 | +## Implementation Guide |
| 127 | + |
| 128 | +### Installation |
| 129 | + |
| 130 | +```bash |
| 131 | +gh repo clone d-oit/do-gh-sub-issues |
| 132 | +cp -r do-gh-sub-issues/.github your-project/ |
| 133 | +``` |
| 134 | + |
| 135 | +### Customization |
| 136 | + |
| 137 | +Modify `issue-workflow.yml` using the [configuration reference](https://github.com/d-oit/do-gh-sub-issues/wiki/Configuration-Guide) |
| 138 | + |
| 139 | +### Integration |
| 140 | + |
| 141 | +The validation action automatically runs on: |
| 142 | + |
| 143 | +- New pull requests |
| 144 | +- Issue modifications |
| 145 | +- Workflow file changes |
| 146 | + |
| 147 | +## Personal Usage Notes |
| 148 | + |
| 149 | +In my daily work: |
| 150 | + |
| 151 | +- I prefix all issue titles with type identifiers (`Epic:`, `Task:`, etc.) |
| 152 | +- PR descriptions explicitly reference parent issues |
| 153 | +- Configuration changes go through standard code review |
| 154 | +- The system handles cross-repository dependencies |
| 155 | + |
| 156 | +## Getting Started Suggestions |
| 157 | + |
| 158 | +For new adopters, I recommend: |
| 159 | + |
| 160 | +1. Start with basic parent-child relationships |
| 161 | +2. Gradually add status mapping rules |
| 162 | +3. Use the `--dry-run` flag during initial setup |
| 163 | +4. Review validation reports before enabling strict mode |
| 164 | + |
| 165 | +The template includes [example configurations](https://github.com/d-oit/do-gh-sub-issues/tree/main/examples) for different project scales. |
| 166 | + |
| 167 | +## Future Considerations |
| 168 | + |
| 169 | +While Bash works well for the reference implementation, production systems might benefit from: |
| 170 | + |
| 171 | +- **Python**: Better error handling and testing frameworks |
| 172 | +- **Rust**: Memory safety and performance for large repositories |
| 173 | +- **TypeScript**: Integration with existing web tooling |
| 174 | + |
| 175 | +The core logic remains transferable across implementations. |
| 176 | + |
| 177 | +## References |
| 178 | + |
| 179 | +- [GitHub's sub-issues announcement](https://github.blog/engineering/architecture-optimization/introducing-sub-issues-enhancing-issue-management-on-github/) |
| 180 | +- [Tilburg Science Hub - Issue Management](https://tilburgsciencehub.com/topics/automation/version-control/start-git/write-good-issues/) |
| 181 | +- [GitProtect.io - GitHub Issues Guide](https://gitprotect.io/blog/mastering-github-issues-best-practices-and-pro-tips/) |
0 commit comments