Handle GitCode PR workflow for OpenHarmony - commit changes, push to fork remote, create issue, create PR from fork to upstream using repo's .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md with issue linking via
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Handle GitCode PR workflow for OpenHarmony - commit changes, push to fork remote, create issue, create PR from fork to upstream using repo's .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md with issue linking via
GitCode PR Workflow for OpenHarmony
Handles complete GitCode PR submission for OpenHarmony repositories with intelligent remote detection and issue-PR linking. Use the gitcode mcp. If gitcode mcp is not present, warn the user and terminate the skill immediately.
Intelligent Remote Detection
Identification Algorithm
Never assume remote names. Use this algorithm to identify upstream and fork:
# Step 1: List all remotes
git remote -v
# Step 2: Parse each remotefor remote in $(git remote); do
url=$(git remote get-url $remote)
# Parse owner from URL# Format: https://gitcode.com/<owner>/<repo> or https://gitcode.com/<owner>/<repo>.gitif [[ "$url" =~ https://gitcode\.com/([^/]+)/(.+) ]]; then
owner="${BASH_REMATCH[1]}"
repo=$(echo"${BASH_REMATCH[2]}" | sed 's/\.git$//')
# Determine typeif [ "$owner" = "openharmony" ];
then
echo
"$remote: UPSTREAM ($owner/$repo)"
else
echo
"$remote: FORK ($owner/$repo)"
fi
fi
done
Remote Classification
Owner
Type
Usage
openharmony
UPSTREAM
Source for PR template, target for PR base, issue creation
Other usernames
FORK
Push target, PR head source
Decision Matrix
Upstream Remotes
Fork Remotes
Action
Found
Found
Use both: create issue/PR on upstream, push to fork
Found
None
Ask user: "Found upstream but no fork. Need to fork first?"
None
Found
Use fork as both push target and PR target (uncommon)
None
Multiple (no openharmony)
Ask user to select: "Which remote to use?"
None
Single (no openharmony)
Use as fork, warn: "No upstream (openharmony) remote found"
User Prompting
When remote is ambiguous, prompt user:
I found these GitCode remotes:
-**remote_name**: owner/repo (UPSTREAM/FORK)
Which remote should I use for:
- Pushing changes?
- Creating the PR?
Please specify the remote name, or press Enter to use [default].
Workflow
Follow this workflow when user requests PR submission:
1. Check Current State
Check git status and branch:
git status
git branch --show-current
git remote -v
Determine:
What is the current branch name?
Identify upstream and fork remotes using algorithm above
2. Check if PR Exists
Use gitcode_list_pull_requests to check for existing PRs:
# Get upstream owner/repo (parse from upstream remote URL)
UPSTREAM_REMOTE=$(detect_upstream_remote)
UPSTREAM_URL=$(git remote get-url $UPSTREAM_REMOTE)
# Parse: openharmony/security_code_signature from URL# List PRs for upstream repo
gitcode_list_pull_requests --owner $UPSTREAM_OWNER --repo $UPSTREAM_REPO# Search for PR with matching branch name and owner name
If PR exists: Only push to fork and inform user.
git push -u $FORK_REMOTE <branch-name>
If PR does not exist: Continue to steps 4-6 to create issue and PR.
3. Create Issue
Load issue template and create issue:
Read issue template: references/issue_template.md
Fill in template fields based on context (commit messages, changed files, etc.)
Use gitcode_create_issue with upstream owner/repo
Note: Use commit message and git diff to generate issue description automatically.
4. Push to Fork
Push to your fork (the detected fork remote):
git push -u $FORK_REMOTE <branch-name>
5. Create PR from Fork to Upstream
Load PR template from upstream repository and create PR linking to issue:
Get upstream PR template:
# Try local copy firstif [ -f .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md ]; thencat .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
else# Fetch from upstream
git fetch $UPSTREAM_REMOTE master
git show $UPSTREAM_REMOTE/master:.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
fi
Fill template:
Follow the direction in the template.
Create PR using gitcode_create_pull_request:
IMPORTANT: For cross-repo PRs, the head parameter format is CRITICAL.
Must be exactly: <fork-owner>:<branch-name> (no extra prefixes)
GitCode API strictly validates this format for cross-fork PRs