mirror of
https://github.com/vince-winkintel/gitlab-cli-skills.git
synced 2026-09-19 06:01:21 +08:00
c29467a0e7
- Added 5 high-value automation scripts: * mr-review-workflow.sh - Automated MR review with tests * create-mr-from-issue.sh - Create branch + draft MR from issue * ci-debug.sh - Debug CI failures (find failed jobs + logs) * batch-label-issues.sh - Apply labels to multiple issues * sync-fork.sh - Sync fork with upstream - Created scripts/README.md with usage documentation - Added TOC to glab-mr/references/commands.md (656 lines) - Updated SKILL.md files to reference relevant scripts - Added troubleshooting sections to: * glab-mr: merge conflicts, approval issues, pipeline problems * glab-repo: clone failures, fork issues, transfer problems * (glab-auth and glab-ci already had troubleshooting from Phase 1) Addresses #13 Phase 2 objectives: ✅ 5 high-value scripts created and documented ✅ TOC added to long reference file (>100 lines) ✅ Troubleshooting sections added to top 5 skills ✅ Scripts follow OpenClaw patterns (token-efficient, deterministic) ✅ All scripts executable and well-documented Token efficiency improvements: - Scripts execute without loading into context - Only script output consumes tokens - Reduces need to regenerate same code repeatedly - Better navigability via TOC in reference docs Co-authored-by: Ubuntu <ubuntu@vps-9755df38.vps.ovh.us>
57 lines
1.6 KiB
Bash
Executable File
57 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Create MR from Issue Script
|
|
# Automates: create branch from issue → prepare for work → create draft MR
|
|
|
|
set -e
|
|
|
|
ISSUE_ID="$1"
|
|
|
|
if [ -z "$ISSUE_ID" ]; then
|
|
echo "Usage: $0 <ISSUE_ID>"
|
|
echo "Example: $0 123"
|
|
exit 1
|
|
fi
|
|
|
|
echo "📋 Fetching issue #$ISSUE_ID details..."
|
|
ISSUE_TITLE=$(glab issue view "$ISSUE_ID" --json title -q .title)
|
|
|
|
if [ -z "$ISSUE_TITLE" ]; then
|
|
echo "❌ Could not fetch issue #$ISSUE_ID"
|
|
exit 1
|
|
fi
|
|
|
|
# Create branch name from issue ID and title
|
|
BRANCH_NAME="$ISSUE_ID-$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/-$//')"
|
|
|
|
echo "🌿 Creating branch: $BRANCH_NAME"
|
|
git checkout -b "$BRANCH_NAME"
|
|
|
|
echo "📝 Issue: #$ISSUE_ID - $ISSUE_TITLE"
|
|
echo ""
|
|
echo "✨ Branch created! Next steps:"
|
|
echo " 1. Make your changes"
|
|
echo " 2. Commit: git add . && git commit -m 'Fix issue #$ISSUE_ID'"
|
|
echo " 3. Push: git push -u origin $BRANCH_NAME"
|
|
echo " 4. Create MR: glab mr create --fill --related-issue $ISSUE_ID"
|
|
echo ""
|
|
echo "Or run this script with --create-mr to create a draft MR now:"
|
|
echo " $0 $ISSUE_ID --create-mr"
|
|
|
|
if [ "$2" = "--create-mr" ]; then
|
|
echo ""
|
|
echo "🚀 Creating draft MR linked to issue #$ISSUE_ID..."
|
|
|
|
# Create empty commit to enable MR creation
|
|
git commit --allow-empty -m "WIP: Issue #$ISSUE_ID - $ISSUE_TITLE"
|
|
git push -u origin "$BRANCH_NAME"
|
|
|
|
glab mr create \
|
|
--draft \
|
|
--fill \
|
|
--related-issue "$ISSUE_ID" \
|
|
--label "work-in-progress"
|
|
|
|
echo "✨ Draft MR created! Mark as ready when work is complete:"
|
|
echo " glab mr update --ready"
|
|
fi
|