-
Notifications
You must be signed in to change notification settings - Fork 12
v2.1.3 #360
v2.1.3 #360
Changes from all commits
fc8b365
b9029f6
c0a6103
9a29a68
86c81f7
4d0b5bc
1d246b0
835e833
aa3ce80
6bbba41
b174fd6
30dabb9
25e1350
7aa4cad
415b917
7095af1
63bcbbb
8ccb1c7
5c5c103
ee21e0d
033e3eb
d05c0f3
9aaa301
62ab841
1b2c123
82a2093
fcb992d
0e13788
058f1a2
047d4d1
aa99e79
f433f20
2211ba9
229e3d0
9693c5d
9d37d0f
ef4d61b
4569bd6
f0458e2
c4e9644
eccc506
7647a25
7fe4841
1ef114e
0e09202
d6f99d6
51dfe6f
eb45693
0f4e18f
7fbb7af
1ac634b
3f91367
efc1be6
e0d2894
8b376fe
5404ad4
7e1ad3d
04f185a
9fdaa47
e20efd1
44bf4ef
ef7dc57
84c0dd8
a6b47ba
3474cb0
c0932ed
cd57b53
70b92ef
c78988e
3b5a068
52784fe
0a18c09
3aff27c
cca1d2c
dab95a9
e336e75
fd187fe
ec591fa
161bc91
9d68579
0a3a481
63b0933
b937bf3
81380cd
c01fb42
c86a96a
48970fb
d69514b
ab41609
3eb21e2
955413a
d642ac4
afb3999
df0bb3e
28a53a4
b361795
cfe74c9
2fd51f0
b86be53
8e33d77
cf21362
894cc1a
c62f679
36bfcfd
eae03a0
eaa2ec6
7925771
72b539f
fd21a53
ec94f5d
ace2080
4ad49a4
9c07826
78eac4c
8d8c315
4739d5b
adcc4a9
5015186
3d25273
754aeea
07d6a42
d4dbf41
d55a869
fd615b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,8 @@ export default async function detectConsoleLogs({ | |
], | ||
}) | ||
.then((result) => { | ||
const openAIResult = result.data.choices[0].message.content.split(","); | ||
const openAIResult = | ||
result.data.choices[0].message.content.split(","); | ||
|
||
const addtionsHaveConsoleLog = openAIResult[0]; | ||
const individualLine = openAIResult[1]; | ||
|
@@ -161,27 +162,34 @@ export default async function detectConsoleLogs({ | |
|
||
const consoleLogPosition = getConsoleLogPosition({ | ||
filePatch: file.patch ?? "", | ||
individualLine | ||
}) | ||
|
||
return octokit.request( | ||
"POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews", | ||
{ | ||
owner, | ||
repo, | ||
pull_number: issue_number, | ||
commit_id: latestCommitHash, | ||
event: "COMMENT", | ||
path: file.filename, | ||
comments: [ | ||
{ | ||
path: file.filename, | ||
position: consoleLogPosition || 1, // comment at the beggining of the file by default | ||
body: "This file contains at least one console log. Please remove any present.", | ||
}, | ||
], | ||
} | ||
); | ||
individualLine, | ||
}); | ||
|
||
return octokit | ||
.request( | ||
"POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews", | ||
{ | ||
owner, | ||
repo, | ||
pull_number: issue_number, | ||
commit_id: latestCommitHash, | ||
event: "COMMENT", | ||
path: file.filename, | ||
comments: [ | ||
{ | ||
path: file.filename, | ||
position: consoleLogPosition || 1, // comment at the beggining of the file by default | ||
body: "This file contains at least one console log. Please remove any present.", | ||
}, | ||
], | ||
} | ||
) | ||
.catch((err) => { | ||
console.log(err); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. |
||
}); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,8 @@ export default async function flagPullRequest({ | |
let botComment = comments.data.find((comment) => { | ||
if (comment.body.includes("This PR contains console logs")) { | ||
// concat to the prompt | ||
prompt += "Since the PR contains console logs, make the maximum rating 8."; | ||
prompt += | ||
"Since the PR contains console logs, make the maximum rating 8."; | ||
} | ||
}); | ||
|
||
|
@@ -67,26 +68,34 @@ export default async function flagPullRequest({ | |
DONT_MERGE: "🚨 Don't Merge", | ||
}; | ||
function deleteLabel(labelName: string) { | ||
octokit.request( | ||
"DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}", | ||
{ | ||
owner, | ||
repo, | ||
issue_number, | ||
name: labelName, | ||
} | ||
); | ||
octokit | ||
.request( | ||
"DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}", | ||
{ | ||
owner, | ||
repo, | ||
issue_number, | ||
name: labelName, | ||
} | ||
) | ||
.catch((error) => { | ||
console.error("Label not found", error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. |
||
}); | ||
} | ||
function addLabel(labelName: string) { | ||
octokit.request( | ||
"POST /repos/{owner}/{repo}/issues/{issue_number}/labels", //add label | ||
{ | ||
owner, | ||
repo, | ||
issue_number, | ||
labels: [labelName], | ||
} | ||
); | ||
octokit | ||
.request( | ||
"POST /repos/{owner}/{repo}/issues/{issue_number}/labels", //add label | ||
{ | ||
owner, | ||
repo, | ||
issue_number, | ||
labels: [labelName], | ||
} | ||
) | ||
.catch((error) => { | ||
console.error("add laber", error); | ||
}); | ||
} | ||
|
||
try { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains at least one console log. Please remove any present.