We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa43fbc commit eba46bbCopy full SHA for eba46bb
1 file changed
src/review-scripts.js
@@ -82,7 +82,21 @@ async function reviewPR() {
82
if (hasMetadata(content)) {
83
// find the line number of the first two "---"
84
const metadataStart = content.indexOf('---');
85
- const metadataEnd = content.indexOf('---', metadataStart + 3);
+ // Find the line number of the second '---'
86
+ let metadataEnd = -1;
87
+ if (metadataStart !== -1) {
88
+ const lines = content.split('\n');
89
+ let dashCount = 0;
90
+ for (let i = 0; i < lines.length; i++) {
91
+ if (lines[i].trim() === '---') {
92
+ dashCount++;
93
+ if (dashCount === 2) {
94
+ metadataEnd = i + 1;
95
+ break;
96
+ }
97
98
99
100
console.log(metadataStart, metadataEnd);
101
reviewBody = `\`\`\`suggestion\n${suggestion}\n\`\`\`\n`;
102
0 commit comments