30 lines
2.4 KiB
Markdown
30 lines
2.4 KiB
Markdown
---
|
|
name: pr
|
|
description: Commit all changes via jsc-git:commit, create a target branch named from the highest-priority commit type plus a summarized title, push, then open a Gitea PR with the templated description. Branch priority is revert > fix > feat > perf > refactor > test > docs > style > chore. Use when work is ready for review; not for plain commits.
|
|
---
|
|
|
|
# pr — create a Push Request
|
|
|
|
## Steps
|
|
|
|
1. Call `jsc-git:commit` to commit every file change first.
|
|
2. Pick the base branch: use `develop` when it exists on the remote, else `main`, else `master`.
|
|
3. Create the target branch from the remote base branch:
|
|
1. Take the type with the highest priority across all commits: `revert > fix > feat > perf > refactor > test > docs > style > chore`.
|
|
2. Summarize one title from all commit messages.
|
|
3. Branch names allow **ASCII only**; always slugify as `{type}/{requirement or feature}-{title}`. Translate the requirement and title into a short English phrase first, then lowercase, replace every character outside `a-z0-9` with a hyphen, collapse consecutive hyphens, and trim leading and trailing hyphens (example: `feat/order-匯出報表` → `feat/order-export-report`). No spaces, parentheses, colons, or any non-ASCII character.
|
|
4. Run `git push -u origin {target branch}`.
|
|
5. Create the PR: `jsc-gitea/tools/gitea.sh pr-create {owner}/{repo} {target branch} {base branch} "{branch name}" {description file}`.
|
|
- Title = branch name.
|
|
- Write the description into a temp file first, using `templates/pr-description.md` (a Traditional Chinese template; the generated description stays in Traditional Chinese per the STE100 output rule).
|
|
6. **Prerequisite PR blocking**: when the description lists a prerequisite Push Request, run
|
|
`jsc-gitea/tools/gitea.sh pr-depend {owner}/{repo} {this PR number} {prerequisite owner}/{repo} {prerequisite PR number}`
|
|
to add the dependency. Gitea then blocks merging until the prerequisite PR closes. If the API is unavailable, degrade: prefix the PR title with `WIP:` (Gitea blocks merging natively) and remove it once the prerequisite is done.
|
|
7. Report the PR URL.
|
|
|
|
## Rules
|
|
|
|
1. No template section may stay empty: fill the literal 「無」 when there is no plan page, analyze page, or prerequisite PR.
|
|
2. Take the plan page and analyze page links from the `jsc-sdlc` wiki pages; the analyze link must point at the work package heading anchor.
|
|
3. The description drafting details **MUST run as a sub agent**.
|