mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
chore: align PR review skills with contributor gh login
This commit is contained in:
@@ -25,7 +25,21 @@ Ask the user using AskQuestion (multi-select):
|
||||
| `bug` + `enhancement` | New feature that also fixes a bug |
|
||||
| `documentation` | README, AGENTS.md, docs-only changes |
|
||||
|
||||
### 2. Ensure branch workflow is reviewable
|
||||
### 2. Resolve the current GitHub assignee
|
||||
|
||||
Before creating or editing any issue assignee, determine the current contributor's GitHub username from the authenticated `gh` session.
|
||||
If `gh` is not signed in or cannot resolve the login, stop and ask the contributor for their GitHub username before proceeding.
|
||||
|
||||
```bash
|
||||
GH_LOGIN=$(gh api user --jq '.login' 2>/dev/null || true)
|
||||
|
||||
if [ -z "$GH_LOGIN" ]; then
|
||||
echo "GitHub username could not be determined from gh auth. Ask the contributor for their GitHub username before proceeding."
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
### 3. Ensure branch workflow is reviewable
|
||||
|
||||
- If already on a short-lived task branch such as `feature/*`, `fix/*`, `docs/*`, or `chore/*`, stay on it.
|
||||
- If on `master`, create a task branch before staging or committing.
|
||||
@@ -44,7 +58,7 @@ Example:
|
||||
git switch -c fix/reply-editor-stuck
|
||||
```
|
||||
|
||||
### 3. Review diffs for relevance
|
||||
### 4. Review diffs for relevance
|
||||
|
||||
```bash
|
||||
git status
|
||||
@@ -56,14 +70,14 @@ Identify which files relate to the work done in this conversation. Only relevant
|
||||
|
||||
**Important**: `git add -p` and `git add -i` are not available (interactive mode unsupported). If a file has mixed relevant/irrelevant changes, include the entire file and note the caveat to the user.
|
||||
|
||||
### 4. Generate issue title and description
|
||||
### 5. Generate issue title and description
|
||||
|
||||
From the conversation context:
|
||||
|
||||
- **Title**: Short, present-tense, describes the **problem** (not the solution). Use backticks for UI elements, code, or literal strings (e.g. Post page `` `Update` `` button disabled and `` `Auto` `` alert unclear).
|
||||
- **Description**: 2-3 sentences about the problem. Use backticks for UI element names (`Update`, `Auto`), function/code references (`useReplies().reset()`), and literal text strings. Write as if the issue hasn't been fixed yet.
|
||||
|
||||
### 5. Create the issue
|
||||
### 6. Create the issue
|
||||
|
||||
```bash
|
||||
gh issue create \
|
||||
@@ -71,12 +85,12 @@ gh issue create \
|
||||
--title "ISSUE_TITLE" \
|
||||
--body "ISSUE_DESCRIPTION" \
|
||||
--label "LABEL1,LABEL2" \
|
||||
--assignee tomcasaburi
|
||||
--assignee "$GH_LOGIN"
|
||||
```
|
||||
|
||||
Capture the issue number from the output.
|
||||
|
||||
### 6. Commit relevant changes
|
||||
### 7. Commit relevant changes
|
||||
|
||||
Stage only the relevant files:
|
||||
|
||||
@@ -99,7 +113,7 @@ EOF
|
||||
- **Scope**: area of the codebase (e.g., `reply-modal`, `markdown`, `routing`)
|
||||
- Prefer title-only commits — skip description when the title is exhaustive
|
||||
|
||||
### 7. Push branch and open PR
|
||||
### 8. Push branch and open PR
|
||||
|
||||
Push the current task branch to origin and open a PR into `master`.
|
||||
|
||||
@@ -131,7 +145,7 @@ If the user later explicitly asks to merge after reviews pass, a separate merge
|
||||
gh pr merge --squash --delete-branch
|
||||
```
|
||||
|
||||
### 8. Add to project board
|
||||
### 9. Add to project board
|
||||
|
||||
Use **gh CLI** for project operations (never GitHub MCP).
|
||||
|
||||
@@ -154,9 +168,9 @@ DONE_OPTION_ID=$(echo "$FIELD_JSON" | jq -r '.fields[] | select(.name=="Status")
|
||||
gh project item-edit --id "$ITEM_ID" --project-id PVT_kwDODohK7M4BM4wg --field-id "$STATUS_FIELD_ID" --single-select-option-id "$DONE_OPTION_ID"
|
||||
```
|
||||
|
||||
Assignees and labels are inherited from the issue (set in step 5) — no separate project update needed.
|
||||
Assignees and labels are inherited from the issue (set in step 6) — no separate project update needed.
|
||||
|
||||
### 9. Report summary
|
||||
### 10. Report summary
|
||||
|
||||
Print a summary to the user:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: review-and-merge-pr
|
||||
description: Review an open GitHub pull request, inspect feedback from Cursor Bugbot, CodeRabbit, CI, and human reviewers, decide which findings are valid, implement fixes on the PR branch, merge the PR into master when it is ready, and finalize the linked GitHub issue and project status after merge. Use when the user says "check the PR", "address bugbot comments", "handle CodeRabbit feedback", "review PR feedback", or "merge this PR".
|
||||
description: Review an open GitHub pull request, inspect feedback from Cursor Bugbot, CodeRabbit, CI, and human reviewers, decide which findings are valid, implement fixes on the PR branch, merge the PR into master when it is ready, and finalize any linked GitHub issue so it matches the make-closed-issue workflow after merge. Use when the user says "check the PR", "address bugbot comments", "handle CodeRabbit feedback", "review PR feedback", or "merge this PR".
|
||||
---
|
||||
|
||||
# Review And Merge Pr
|
||||
@@ -113,34 +113,55 @@ Preferred merge command:
|
||||
gh pr merge <pr-number> --repo bitsocialnet/5chan --squash --delete-branch
|
||||
```
|
||||
|
||||
### 7. Finalize the linked issue and project item
|
||||
### 7. Finalize linked issues to match `make-closed-issue`
|
||||
|
||||
After merge, inspect the PR's linked closing issue.
|
||||
If the merge did not close the issue automatically, close it manually.
|
||||
Then ensure the linked issue is on the `5chan` project and its status is `Done`.
|
||||
After merge, inspect the PR's linked closing issues.
|
||||
For every linked issue, bring it into the same final state expected from `make-closed-issue`:
|
||||
|
||||
- closed
|
||||
- assigned to the current GitHub user
|
||||
- added to the `5chan` project if missing
|
||||
- project status `Done`
|
||||
|
||||
Before editing issue assignees, determine the current contributor's GitHub username from the authenticated `gh` session.
|
||||
If `gh` is not signed in or cannot resolve the login, stop and ask the contributor for their GitHub username before proceeding.
|
||||
If the PR has no linked issue, explicitly tell the user that there was no associated issue to finalize.
|
||||
|
||||
Useful commands:
|
||||
|
||||
```bash
|
||||
ISSUE_NUMBER=$(gh pr view <pr-number> --repo bitsocialnet/5chan --json closingIssuesReferences --jq '.closingIssuesReferences[0].number // empty')
|
||||
GH_LOGIN=$(gh api user --jq '.login' 2>/dev/null || true)
|
||||
|
||||
if [ -n "$ISSUE_NUMBER" ]; then
|
||||
ISSUE_STATE=$(gh issue view "$ISSUE_NUMBER" --repo bitsocialnet/5chan --json state --jq '.state')
|
||||
if [ "$ISSUE_STATE" != "CLOSED" ]; then
|
||||
gh issue close "$ISSUE_NUMBER" --repo bitsocialnet/5chan
|
||||
fi
|
||||
if [ -z "$GH_LOGIN" ]; then
|
||||
echo "GitHub username could not be determined from gh auth. Ask the contributor for their GitHub username before proceeding."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ITEM_ID=$(gh project item-list 1 --owner bitsocialnet --limit 1000 --format json --jq ".items[] | select(.content.number == $ISSUE_NUMBER) | .id" | head -n1)
|
||||
if [ -z "$ITEM_ID" ]; then
|
||||
ITEM_JSON=$(gh project item-add 1 --owner bitsocialnet --url "https://github.com/bitsocialnet/5chan/issues/$ISSUE_NUMBER" --format json)
|
||||
ITEM_ID=$(echo "$ITEM_JSON" | jq -r '.id')
|
||||
fi
|
||||
ISSUE_NUMBERS=$(gh pr view <pr-number> --repo bitsocialnet/5chan --json closingIssuesReferences --jq '.closingIssuesReferences[].number')
|
||||
|
||||
if [ -n "$ISSUE_NUMBERS" ]; then
|
||||
FIELD_JSON=$(gh project field-list 1 --owner bitsocialnet --format json)
|
||||
STATUS_FIELD_ID=$(echo "$FIELD_JSON" | jq -r '.fields[] | select(.name=="Status") | .id')
|
||||
DONE_OPTION_ID=$(echo "$FIELD_JSON" | jq -r '.fields[] | select(.name=="Status") | .options[] | select(.name=="Done") | .id')
|
||||
|
||||
gh project item-edit --id "$ITEM_ID" --project-id PVT_kwDODohK7M4BM4wg --field-id "$STATUS_FIELD_ID" --single-select-option-id "$DONE_OPTION_ID"
|
||||
for ISSUE_NUMBER in $ISSUE_NUMBERS; do
|
||||
ISSUE_STATE=$(gh issue view "$ISSUE_NUMBER" --repo bitsocialnet/5chan --json state --jq '.state')
|
||||
if [ "$ISSUE_STATE" != "CLOSED" ]; then
|
||||
gh issue close "$ISSUE_NUMBER" --repo bitsocialnet/5chan
|
||||
fi
|
||||
|
||||
if ! gh issue view "$ISSUE_NUMBER" --repo bitsocialnet/5chan --json assignees --jq '.assignees[].login' | grep -qx "$GH_LOGIN"; then
|
||||
gh issue edit "$ISSUE_NUMBER" --repo bitsocialnet/5chan --add-assignee "$GH_LOGIN"
|
||||
fi
|
||||
|
||||
ITEM_ID=$(gh project item-list 1 --owner bitsocialnet --limit 1000 --format json --jq ".items[] | select(.content.number == $ISSUE_NUMBER) | .id" | head -n1)
|
||||
if [ -z "$ITEM_ID" ]; then
|
||||
ITEM_JSON=$(gh project item-add 1 --owner bitsocialnet --url "https://github.com/bitsocialnet/5chan/issues/$ISSUE_NUMBER" --format json)
|
||||
ITEM_ID=$(echo "$ITEM_JSON" | jq -r '.id')
|
||||
fi
|
||||
|
||||
gh project item-edit --id "$ITEM_ID" --project-id PVT_kwDODohK7M4BM4wg --field-id "$STATUS_FIELD_ID" --single-select-option-id "$DONE_OPTION_ID"
|
||||
done
|
||||
fi
|
||||
```
|
||||
|
||||
@@ -170,6 +191,7 @@ Tell the user:
|
||||
- which findings were declined and why
|
||||
- which verification commands ran
|
||||
- whether the PR was merged
|
||||
- whether the linked issue was confirmed closed
|
||||
- whether the linked project item was confirmed `Done`
|
||||
- whether linked issues were confirmed closed
|
||||
- whether linked issues were assigned to the current GitHub user
|
||||
- whether linked project items were confirmed `Done`
|
||||
- whether the feature branch, local `pr/<number>` alias, and any worktree were cleaned up
|
||||
|
||||
Reference in New Issue
Block a user