227 lines
3.0 KiB
Markdown
227 lines
3.0 KiB
Markdown
# Helpdesk Git Integration Guide
|
|
|
|
## Gitea & GitHub Integration, Ticket Linking, Development Workflow, and Deployment Standards
|
|
|
|
Version: 1.0
|
|
Module: Helpdesk
|
|
Platform: WMS Core
|
|
Last Updated: June 2026
|
|
|
|
## Overview
|
|
|
|
The Helpdesk Git Integration allows tickets to be linked directly to commits, branches, pull requests, merges, repository activity, and deployments.
|
|
|
|
### Ticket Reference Format
|
|
|
|
```text
|
|
HD-YYYY-NNNNN
|
|
```
|
|
|
|
Example:
|
|
|
|
```text
|
|
HD-2026-00012
|
|
```
|
|
|
|
## Automatic Linking Rules
|
|
|
|
The integration searches for ticket references in:
|
|
|
|
- Commit messages
|
|
- Branch names
|
|
- Pull request titles
|
|
- Merge commits
|
|
|
|
### Example Commit
|
|
|
|
```text
|
|
HD-2026-00012 Fix ticket-level Git commit display
|
|
```
|
|
|
|
### Example Branch
|
|
|
|
```text
|
|
bugfix/HD-2026-00012-fix-ticket-display
|
|
```
|
|
|
|
## GitFlow Branch Standards
|
|
|
|
### Feature
|
|
|
|
```text
|
|
feature/HD-2026-00012-add-sla-dashboard
|
|
```
|
|
|
|
### Bugfix
|
|
|
|
```text
|
|
bugfix/HD-2026-00012-fix-ticket-display
|
|
```
|
|
|
|
### Hotfix
|
|
|
|
```text
|
|
hotfix/HD-2026-00012-production-fix
|
|
```
|
|
|
|
## Commit Standards
|
|
|
|
Always place the ticket reference first.
|
|
|
|
```text
|
|
HD-2026-00012 Fix ticket-level Git commit display
|
|
```
|
|
|
|
## GitHub Setup
|
|
|
|
### Repository
|
|
|
|
```bash
|
|
git init
|
|
git remote add origin https://github.com/company/repository.git
|
|
git remote -v
|
|
```
|
|
|
|
### Webhook
|
|
|
|
Settings → Webhooks → Add Webhook
|
|
|
|
Webhook URL:
|
|
|
|
```text
|
|
https://your-domain/helpdesk/git/github/webhook
|
|
```
|
|
|
|
Events:
|
|
|
|
- Push
|
|
- Pull Request
|
|
- Pull Request Review
|
|
- Release
|
|
|
|
## Gitea Setup
|
|
|
|
### Repository
|
|
|
|
```bash
|
|
git init
|
|
git remote add origin http://git.vm:3000/Admin/WMS-Core.git
|
|
git remote -v
|
|
```
|
|
|
|
### Webhook
|
|
|
|
Settings → Webhooks → Add Webhook
|
|
|
|
Webhook URL:
|
|
|
|
```text
|
|
https://your-domain/helpdesk/git/gitea/webhook
|
|
```
|
|
|
|
Events:
|
|
|
|
- Push
|
|
- Pull Request
|
|
- Merge
|
|
- Tags
|
|
|
|
## Standard Workflow
|
|
|
|
### Create Ticket
|
|
|
|
```text
|
|
HD-2026-00012
|
|
```
|
|
|
|
### Create Branch
|
|
|
|
```bash
|
|
git checkout develop
|
|
git checkout -b bugfix/HD-2026-00012-fix-ticket-display
|
|
```
|
|
|
|
### Test
|
|
|
|
```bash
|
|
composer test
|
|
```
|
|
|
|
### Commit
|
|
|
|
```bash
|
|
git add .
|
|
git commit -m "HD-2026-00012 Fix ticket-level Git commit display"
|
|
```
|
|
|
|
### Push
|
|
|
|
```bash
|
|
git push origin bugfix/HD-2026-00012-fix-ticket-display
|
|
```
|
|
|
|
### Pull Request
|
|
|
|
```text
|
|
HD-2026-00012 Fix ticket-level Git commit display
|
|
```
|
|
|
|
## Manual Linking
|
|
|
|
```php
|
|
Modules\Helpdesk\Models\GitCommit::find(7)->update([
|
|
'ticket_id' => 18,
|
|
]);
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Verify Commits
|
|
|
|
```bash
|
|
php artisan tinker
|
|
```
|
|
|
|
```php
|
|
Modules\Helpdesk\Models\GitCommit::count();
|
|
```
|
|
|
|
### Ticket Shows No Commits
|
|
|
|
```php
|
|
Modules\Helpdesk\Models\GitCommit
|
|
::where('ticket_id', 18)
|
|
->get();
|
|
```
|
|
|
|
or
|
|
|
|
```php
|
|
Modules\Helpdesk\Models\GitCommit
|
|
::where('message', 'like', '%HD-2026-00012%')
|
|
->get();
|
|
```
|
|
|
|
## Recommended Standard
|
|
|
|
Every code change should contain:
|
|
|
|
- Ticket reference in branch name
|
|
- Ticket reference in commit message
|
|
- Ticket reference in PR title
|
|
|
|
Example:
|
|
|
|
```text
|
|
Branch:
|
|
bugfix/HD-2026-00012-fix-ticket-display
|
|
|
|
Commit:
|
|
HD-2026-00012 Fix ticket-level Git commit display
|
|
|
|
PR:
|
|
HD-2026-00012 Fix ticket-level Git commit display
|
|
```
|
|
|
|
This ensures automatic linking and complete traceability.
|