kunibert
All repositories: gitoria
2.4 KB
$mode = 'static'import { run } from 'hl:proc'import { require } from './review-output.hl'// Read the optional ignore file from the exact PR HEAD, also before a worktree exists.vendoredPaths = (String repo, String head, Hybrid configured) => {prefixes = []for (p of configured) { if (p != '' && !prefixes.includes(p)) { prefixes.push(p) } }names = run(['git', 'ls-tree', '--name-only', head, '--', '.kunibertignore'], { cwd = repo, timeout = 30 })require(names.exit == 0, 'cannot look up .kunibertignore at PR head')if (!names.lines.includes('.kunibertignore')) { return prefixes }file = run(['git', 'show', head + ':.kunibertignore'], { cwd = repo, timeout = 30 })require(file.exit == 0, 'cannot read .kunibertignore at PR head')for (line of file.lines) {p = line.trim()if (p != '' && !p.startsWith('#') && !prefixes.includes(p)) { prefixes.push(p) }}return prefixes}isVendored = (String path, Hybrid prefixes) => {for (p of prefixes) { if (path.startsWith(p)) { return true } }return false}// Keep old keys stable, but settle these threads before thread updates and wake prompts.settleVendored = (Hybrid state, Hybrid prefixes) => {for (let i = 0; i < state.threads.length; i = i + 1) {t = state.threads[i]if (isVendored(t.path, prefixes)) {t.vendored = truet.settled = trueif (!state.settled.includes(t.key)) { state.settled.push(t.key) }state.threads[i] = t}}return state}// Only app findings enter applyResult: framework findings never get a thread key.appResult = (Hybrid result, Hybrid prefixes, Hybrid state, String link) => {app = []framework = []for (f of result.findings) {if (isVendored(f.path, prefixes)) { framework.push(f) } else { app.push(f) }}replies = []for (r of result.replies) {let vendored = falsefor (t of state.threads) { if (t.key == r.thread && t.vendored) { vendored = true } }if (!vendored) { replies.push(r) }}result.findings = appresult.framework = frameworkresult.replies = repliesresult.vendoredLink = linkif (prefixes.length > 0) {result.verdict = app.length == 0 ? 'approve' : 'comment'for (f of app) { if (f.severity == 'blocker' || f.severity == 'major') { result.verdict = 'request_changes' } }}return result}
Branches
Latest commits
- b143c3c7CONDUCTOR: push recipemre
- 7a1279eeRule: conductor merges own utility PRs after green reviewmre
- 4038b3e0Log: kunibert#18 openedmre
- 18543db1Log: day42 fetch fix, re-vendor pendingmre
- 81a12f96Statusmre
- 6ce706abRecords: neutral wording, split cleanupmre
- 81a4d31bDocs: neutral wordingKunibert
- 8205b05eRecords: #17 livemre
- c3391204Answer fresh reviews under open threadsKunibert
- a0f3d147Records: #16 livemre
- 04322148Run reviews in parallel across repositoriesKunibert
- a6577aaeRecords: #14 live, #16 startedmre
- 0382238bStart fresh on Review again and name vendored pathsKunibert
- 5608c6f1Records: kunibert#13 vendored paths livemre
- 8840771dExclude vendored findings from app verdictsKunibert
- 6aa65353Records: jukebox connected, first reviewmre
- ad8011cfRecords: neutral ticket rule, jukeboxmre
- ca5f31dfPrompt: neutral reviewer identitymre
- b241d9c8Records: Anton tryParse noteKunibert
- 42cc1bc0Records: K12 doneKunibert