Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Instruct LLM to use pull request template when creating PRs#1442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
almaleksia merged 2 commits intomainfromalmaleksia/use-pr-template
Nov 19, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletionspkg/github/instructions.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@ func GenerateInstructions(enabledToolsets []string) string {

// Individual toolset instructions
for_,toolset:=rangeenabledToolsets {
ifinst:=getToolsetInstructions(toolset);inst!="" {
ifinst:=getToolsetInstructions(toolset,enabledToolsets);inst!="" {
instructions=append(instructions,inst)
}
}
Expand All@@ -48,12 +48,18 @@ Tool usage guidance:
}

// getToolsetInstructions returns specific instructions for individual toolsets
funcgetToolsetInstructions(toolsetstring)string {
funcgetToolsetInstructions(toolsetstring,enabledToolsets []string)string {
switchtoolset {
case"pull_requests":
return`## Pull Requests
pullRequestInstructions:=`## Pull Requests
PR review workflow: Always use 'pull_request_review_write' with method 'create' to create a pending review, then 'add_comment_to_pending_review' to add comments, and finally 'pull_request_review_write' with method 'submit_pending' to submit the review for complex reviews with line-specific comments.`
ifslices.Contains(enabledToolsets,"repos") {
pullRequestInstructions+=`
Before creating a pull request, search for pull request templates in the repository. Template files are called pull_request_template.md or they're located in '.github/PULL_REQUEST_TEMPLATE' directory. Use the template content to structure the PR description and then call create_pull_request tool.`
}
returnpullRequestInstructions
case"issues":
return`## Issues
Expand Down
30 changes: 25 additions & 5 deletionspkg/github/instructions_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ package github

import (
"os"
"strings"
"testing"
)

Expand DownExpand Up@@ -128,12 +129,23 @@ func TestGenerateInstructionsWithDisableFlag(t *testing.T) {

funcTestGetToolsetInstructions(t*testing.T) {
tests:= []struct {
toolsetstring
expectedEmptybool
toolsetstring
expectedEmptybool
enabledToolsets []string
expectedToContainstring
notExpectedToContainstring
}{
{
toolset:"pull_requests",
expectedEmpty:false,
toolset:"pull_requests",
expectedEmpty:false,
enabledToolsets: []string{"pull_requests","repos"},
expectedToContain:"pull_request_template.md",
},
{
toolset:"pull_requests",
expectedEmpty:false,
enabledToolsets: []string{"pull_requests"},
notExpectedToContain:"pull_request_template.md",
},
{
toolset:"issues",
Expand All@@ -151,7 +163,7 @@ func TestGetToolsetInstructions(t *testing.T) {

for_,tt:=rangetests {
t.Run(tt.toolset,func(t*testing.T) {
result:=getToolsetInstructions(tt.toolset)
result:=getToolsetInstructions(tt.toolset,tt.enabledToolsets)
iftt.expectedEmpty {
ifresult!="" {
t.Errorf("Expected empty result for toolset '%s', but got: %s",tt.toolset,result)
Expand All@@ -161,6 +173,14 @@ func TestGetToolsetInstructions(t *testing.T) {
t.Errorf("Expected non-empty result for toolset '%s', but got empty",tt.toolset)
}
}

iftt.expectedToContain!=""&&!strings.Contains(result,tt.expectedToContain) {
t.Errorf("Expected result to contain '%s' for toolset '%s', but it did not. Result: %s",tt.expectedToContain,tt.toolset,result)
}

iftt.notExpectedToContain!=""&&strings.Contains(result,tt.notExpectedToContain) {
t.Errorf("Did not expect result to contain '%s' for toolset '%s', but it did. Result: %s",tt.notExpectedToContain,tt.toolset,result)
}
})
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp