(null);
const { toast } = useToast();
+ const [commitMessage, setCommitMessage] = useState("Update test files");
const handleTests = async (pr: PullRequest, mode: "write" | "update") => {
setAnalyzing(true);
@@ -139,7 +141,8 @@ export function PullRequestItem({ pullRequest }: PullRequestItemProps) {
pullRequest.repository.owner.login,
pullRequest.repository.name,
pullRequest.number,
- filesToCommit
+ filesToCommit,
+ commitMessage
);
toast({
@@ -306,21 +309,31 @@ export function PullRequestItem({ pullRequest }: PullRequestItemProps) {
)}
))}
-
+
+ setCommitMessage(e.target.value)}
+ className="mb-2"
+ />
+
+
)}
diff --git a/app/(dashboard)/dashboard/types.ts b/app/(dashboard)/dashboard/types.ts
index ab5ca7fb..d4843fc5 100644
--- a/app/(dashboard)/dashboard/types.ts
+++ b/app/(dashboard)/dashboard/types.ts
@@ -20,3 +20,11 @@ export interface TestFile {
content: string;
oldContent?: string;
}
+
+export type CommitChangesToPullRequest = (
+ owner: string,
+ repo: string,
+ pullNumber: number,
+ filesToCommit: TestFile[],
+ commitMessage: string
+) => Promise;
diff --git a/lib/github.ts b/lib/github.ts
index 13be9e64..23ec5261 100644
--- a/lib/github.ts
+++ b/lib/github.ts
@@ -106,7 +106,8 @@ export async function commitChangesToPullRequest(
owner: string,
repo: string,
pullNumber: number,
- filesToCommit: TestFile[]
+ filesToCommit: TestFile[],
+ commitMessage: string
): Promise {
const octokit = await getOctokit();
@@ -181,7 +182,7 @@ export async function commitChangesToPullRequest(
const { data: newCommit } = await octokit.git.createCommit({
owner,
repo,
- message: "Update test files",
+ message: commitMessage,
tree: newTree.sha,
parents: [commit.sha],
});