gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7a1279ee7a1279eeRule: conductor merges own utility PRs after green reviewmre7a1279ee/lib/review-vendored.hl

2.4 KB

  1. $mode = 'static'
  2. import { run } from 'hl:proc'
  3. import { require } from './review-output.hl'
  4. // Read the optional ignore file from the exact PR HEAD, also before a worktree exists.
  5. vendoredPaths = (String repo, String head, Hybrid configured) => {
  6. prefixes = []
  7. for (p of configured) { if (p != '' && !prefixes.includes(p)) { prefixes.push(p) } }
  8. names = run(['git', 'ls-tree', '--name-only', head, '--', '.kunibertignore'], { cwd = repo, timeout = 30 })
  9. require(names.exit == 0, 'cannot look up .kunibertignore at PR head')
  10. if (!names.lines.includes('.kunibertignore')) { return prefixes }
  11. file = run(['git', 'show', head + ':.kunibertignore'], { cwd = repo, timeout = 30 })
  12. require(file.exit == 0, 'cannot read .kunibertignore at PR head')
  13. for (line of file.lines) {
  14. p = line.trim()
  15. if (p != '' && !p.startsWith('#') && !prefixes.includes(p)) { prefixes.push(p) }
  16. }
  17. return prefixes
  18. }
  19. isVendored = (String path, Hybrid prefixes) => {
  20. for (p of prefixes) { if (path.startsWith(p)) { return true } }
  21. return false
  22. }
  23. // Keep old keys stable, but settle these threads before thread updates and wake prompts.
  24. settleVendored = (Hybrid state, Hybrid prefixes) => {
  25. for (let i = 0; i < state.threads.length; i = i + 1) {
  26. t = state.threads[i]
  27. if (isVendored(t.path, prefixes)) {
  28. t.vendored = true
  29. t.settled = true
  30. if (!state.settled.includes(t.key)) { state.settled.push(t.key) }
  31. state.threads[i] = t
  32. }
  33. }
  34. return state
  35. }
  36. // Only app findings enter applyResult: framework findings never get a thread key.
  37. appResult = (Hybrid result, Hybrid prefixes, Hybrid state, String link) => {
  38. app = []
  39. framework = []
  40. for (f of result.findings) {
  41. if (isVendored(f.path, prefixes)) { framework.push(f) } else { app.push(f) }
  42. }
  43. replies = []
  44. for (r of result.replies) {
  45. let vendored = false
  46. for (t of state.threads) { if (t.key == r.thread && t.vendored) { vendored = true } }
  47. if (!vendored) { replies.push(r) }
  48. }
  49. result.findings = app
  50. result.framework = framework
  51. result.replies = replies
  52. result.vendoredLink = link
  53. if (prefixes.length > 0) {
  54. result.verdict = app.length == 0 ? 'approve' : 'comment'
  55. for (f of app) { if (f.severity == 'blocker' || f.severity == 'major') { result.verdict = 'request_changes' } }
  56. }
  57. return result
  58. }

Branches

Latest commits

  • 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
  • 9e6039eeRecords: gates K11, K12Kunibert