--- name: git-issue-updater description: Update GitHub issues and JIRA tickets with commit progress including user, date, time, and consistent documentation formatting for traceability license: Apache-2.0 compatibility: opencode metadata: audience: developers, maintainers workflow: issue-tracking --- ## What I do I provide automatic issue progress updates for both GitHub and JIRA after commits are made: 1. **Extract Commit Details**: Get latest commit info: hash, message, author, date, time, files changed 2. **Determine Issue Reference**: Extract GitHub issue number (#123) or JIRA ticket key (PROJECT-123) from commit message 3. **Format Update Comment**: Create consistent documentation with user, date, time, changes summary 4. **Support Multiple Platforms**: Add comments to GitHub issues or JIRA tickets 5. **Include Metadata**: Add commit link (GitHub) or hash (JIRA), user info, timestamp 6. **Handle Incremental Updates**: Support multiple commits with cumulative or per-commit updates 7. **Verify Updates**: Confirm comment was successfully added to issue/ticket ## When to use me Use this framework when: - You need to track commit progress in GitHub issues or JIRA tickets - You've made commits and want to update the associated issue/ticket - You want consistent documentation of progress with timestamps and user info - You're creating a workflow that makes commits and should update issues - You need traceability between commits and issues - You want to maintain consistency in issue/ticket comments - You're working with teams that require progress updates in issues This is a **framework skill** - it provides issue update functionality that other skills use. ## Core Workflow Steps ### Step 1: Extract Latest Commit Information **Purpose**: Get all relevant details from the most recent commit **Git Commands for Commit Info**: ```bash # Get latest commit hash COMMIT_HASH=$(git rev-parse HEAD) # Get commit message (subject and body) COMMIT_MSG=$(git log -1 --pretty=%B) # Get commit author COMMIT_AUTHOR=$(git log -1 --pretty=%an) # Get commit author email COMMIT_EMAIL=$(git log -1 --pretty=%ae) # Get commit date and time in ISO 8601 format COMMIT_DATE=$(git log -1 --date=iso8601 --pretty=%aI) # Get commit date in human-readable format COMMIT_DATE_HUMAN=$(git log -1 --date=short --pretty=%aI) # Get commit time (24-hour format with timezone) COMMIT_TIME=$(git log -1 --date=format:%H:%M%z --pretty=%aI) # Get list of changed files CHANGED_FILES=$(git show --name-only --pretty=format: HEAD | grep -v "^$") # Get file change statistics FILE_STATS=$(git diff --stat HEAD~1 HEAD) ``` **Expected Output Example**: ``` COMMIT_HASH: "5f3a2b1c4d5e6f7" COMMIT_MSG: "feat(auth): add OAuth2 support" COMMIT_AUTHOR: "John Doe" COMMIT_EMAIL: "john.doe@example.com" COMMIT_DATE: "2024-01-25T14:30:45+08:00" COMMIT_DATE_HUMAN: "2024-01-25" COMMIT_TIME: "14:30+0800" CHANGED_FILES: "src/auth/oauth.ts src/auth/token.ts src/api/auth.ts" ``` ### Step 2: Determine Issue Reference **Purpose**: Extract GitHub issue number or JIRA ticket key from commit message **GitHub Issue Detection**: ```bash # Extract issue number from commit message (format: #123) ISSUE_NUM=$(echo "$COMMIT_MSG" | grep -oE '#[0-9]+' | head -1 | sed 's/#//') if [ -n "$ISSUE_NUM" ]; then ISSUE_TYPE="github" ISSUE_REF="#$ISSUE_NUM" ISSUE_URL="https://github.com/$REPO_OWNER/$REPO_NAME/issues/$ISSUE_NUM" fi ``` **JIRA Ticket Detection**: ```bash # Extract JIRA ticket key from commit message (format: PROJECT-123) TICKET_KEY=$(echo "$COMMIT_MSG" | grep -oE '[A-Z]+-[0-9]+' | head -1) if [ -n "$TICKET_KEY" ]; then ISSUE_TYPE="jira" ISSUE_REF="$TICKET_KEY" TICKET_URL="https://company.atlassian.net/browse/$TICKET_KEY" fi ``` **Combined Detection Logic**: ```bash # Try GitHub first ISSUE_NUM=$(echo "$COMMIT_MSG" | grep -oE '#[0-9]+' | head -1 | sed 's/#//') # If no GitHub issue, try JIRA if [ -z "$ISSUE_NUM" ]; then TICKET_KEY=$(echo "$COMMIT_MSG" | grep -oE '[A-Z]+-[0-9]+' | head -1) if [ -n "$TICKET_KEY" ]; then ISSUE_TYPE="jira" ISSUE_REF="$TICKET_KEY" fi else ISSUE_TYPE="github" ISSUE_REF="#$ISSUE_NUM" fi # If neither found, ask user or use branch name if [ -z "$ISSUE_TYPE" ]; then BRANCH_NAME=$(git branch --show-current) # Check if branch name contains issue reference if echo "$BRANCH_NAME" | grep -qE '^[0-9]+$'; then ISSUE_TYPE="github" ISSUE_REF="#$BRANCH_NAME" elif echo "$BRANCH_NAME" | grep -qE '[A-Z]+-[0-9]+$'; then ISSUE_TYPE="jira" ISSUE_REF="$BRANCH_NAME" else echo "⚠️ No issue reference found in commit message or branch name" echo " Please manually specify issue to update" read -p "Enter issue/ticket reference: " ISSUE_REF fi fi echo "Detected issue type: $ISSUE_TYPE" echo "Issue reference: $ISSUE_REF" ``` ### Step 3: Format Update Comment **Purpose**: Create a consistent, well-formatted progress update **Comment Template**: ```markdown ## Progress Update - at