-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrawler.js
38 lines (31 loc) · 970 Bytes
/
crawler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Octokit } from "octokit";
import { getKey, getRepos, writeResults } from "./text-handler.js";
// My Github Personal Access Token
const GITHUB_PAT = getKey();
const WASM_REPOS = getRepos();
const WASM_ISSUES = [];
// Instantiate an octokit object with my PAT
const octokit = new Octokit({
auth: GITHUB_PAT,
});
// Search for all issues for each repo found
async function searchIssues() {
for (let i in WASM_REPOS) {
const repo = WASM_REPOS[i];
console.log(`Attempting to get issues in ${repo}...`)
const resp = await octokit.paginate("GET /search/issues", {
q: `security OR vulerability is:issue repo:${repo}`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
per_page: 100,
});
console.log(`${resp.length} results found...\n`)
resp.forEach((issue) => {
WASM_ISSUES.push(issue['html_url']);
});
}
// Write the results to issues.txt
writeResults(WASM_ISSUES);
}
searchIssues();