Skip to content

Commit a5e9a0a

Browse files
committed
Fixes
1 parent 245feb3 commit a5e9a0a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

scripts/pr-review-bot/github.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Octokit } from "@octokit/rest";
22

33
// Variables
4-
const owner = "sharadregoti";
4+
const owner = "TykTechnologies";
55
const repo = "tyk-docs";
66
// const pull_number = parseInt(process.env.PR_NUMBER); // Convert to integer
77
const pull_number = process.env.PR_NUMBER; // Convert to integer

scripts/pr-review-bot/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
import { commentOnPullRequest, getPRBody } from './github.js'
2+
import fs from 'fs';
23

3-
const genericMessage = "This PR does not pass all the checklist mentioned in description, because of which we are closing the PR. Re-open it when all checklist items are passed"
4+
const genericMessage = "This PR does not pass some of the required checklist items mentioned in description, because of which we are closing the PR. Re-open it when all checklist items are passed"
45

56
import { marked } from 'marked';
67

7-
const prBody = await getPRBody()
8-
console.log("Read PR body")
8+
const filePath = '../../.github/pull_request_template.md';
9+
const fileContent = fs.readFileSync(filePath, 'utf8');
10+
11+
// const prBody = await getPRBody()
12+
// console.log("Read PR body")
913

1014
// Function to check if an item is a checklist
1115
function isChecklistItem(item) {
1216
return item.raw && (item.raw.includes('[ ]') || item.raw.includes('[x]'));
1317
}
1418

1519
// Parse the markdown to HTML or AST (Abstract Syntax Tree)
16-
const lexer = marked.lexer(prBody);
20+
const lexer = marked.lexer(fileContent);
1721

1822
// Find the checklist items in the parsed output
1923
const checklistItems = lexer

0 commit comments

Comments
 (0)