gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainbd3591c7conductor: gates run on the live day44 binarymremain/lib/gitoria-events.hl

3.8 KB

  1. $mode = 'static'
  2. \\ THE ONE FILE that knows gitoria's event names and field paths (apps-api.md v0, section 4).
  3. \\ When the contract changes (the [OPEN] marks), only this file changes.
  4. headerEvent = 'x-push-event'
  5. headerDelivery = 'x-push-delivery'
  6. headerSignature = 'x-push-signature-256'
  7. signaturePrefix = 'sha256='
  8. eventNames = ['ping', 'pull_request', 'review_requested', 'review_comment', 'pull_comment', 'review_thread']
  9. botMention = '@kunibert'
  10. isKnown = (name) => {
  11. return name != null && eventNames.includes(name)
  12. }
  13. \\ the repo id the secret is keyed by; null when the body has none
  14. repoId = (body) => {
  15. if (body.repo == null || body.repo.id == null) { return null }
  16. return '' + body.repo.id
  17. }
  18. \\ `@kunibert reset` / `@kunibert <text>` at the start of a comment: { reset } or { note } or null
  19. mention = (text) => {
  20. if (hlTypeName(text) != 'String') { return null }
  21. t = text.trim()
  22. if (!t.toLowerCase().startsWith(botMention)) { return null }
  23. rest = t.slice(botMention.length).trim()
  24. if (rest == '') { return null }
  25. if (rest.toLowerCase() == 'reset') { return { reset = true } }
  26. return { note = rest }
  27. }
  28. \\ A change a job can use, from one parsed event. Answer: { kind, reason, ... }
  29. \\ kind: 'ignore' | 'ping' | 'review' | 'thread-state' | 'close'
  30. \\ A review/thread-state change carries: repo, number, head, time, pull, force, reset, threads, notes, replyCandidate.
  31. \\ review: starts or updates a review job. thread-state: only records a resolved/settled flip (no review).
  32. \\ replyCandidate: a review_comment; the queue makes it threadReplyOnly when it brings no new head.
  33. classify = (String name, Hybrid body) => {
  34. action = body.action
  35. pull = body.pull
  36. if (name == 'ping') { return { kind = 'ping' } }
  37. if (pull == null || pull.number == null || repoId(body) == null) { return { kind = 'ignore', reason = 'no repo.id or pull.number' } }
  38. change = {
  39. kind = 'review'
  40. repoId = repoId(body)
  41. repo = body.repo
  42. number = pull.number
  43. head = pull.head
  44. time = body.time
  45. pull = pull
  46. force = false
  47. reset = false
  48. threads = []
  49. notes = []
  50. delivery = body.delivery
  51. event = name + '.' + action
  52. replyCandidate = false
  53. }
  54. if (name == 'pull_request') {
  55. if (action == 'closed' || action == 'merged') { change.kind = 'close'
  56. return change }
  57. if (pull.draft == true) { return { kind = 'ignore', reason = 'draft pull request' } }
  58. if (action == 'opened' || action == 'reopened' || action == 'synchronize' || action == 'ready') { return change }
  59. return { kind = 'ignore', reason = 'pull_request.' + action + ' not handled' }
  60. }
  61. if (pull.draft == true) { return { kind = 'ignore', reason = 'draft pull request' } }
  62. if (name == 'review_requested') {
  63. change.reset = true
  64. change.force = true
  65. return change
  66. }
  67. if (name == 'review_comment' && action == 'created') {
  68. change.threads.push({ event = 'review_comment.created', thread = body.thread, comment = body.comment })
  69. change.replyCandidate = true
  70. return change
  71. }
  72. if (name == 'review_thread' && (action == 'resolved' || action == 'unresolved')) {
  73. change.threads.push({ event = 'review_thread.' + action, thread = body.thread })
  74. change.kind = 'thread-state'
  75. return change
  76. }
  77. if (name == 'pull_comment' && action == 'created') {
  78. let m = null
  79. if (body.comment != null) { m = mention(body.comment.body) }
  80. if (m == null) { return { kind = 'ignore', reason = 'comment without @kunibert' } }
  81. if (m.reset) { change.reset = true change.force = true }
  82. if (m.note != null) { change.force = true change.notes.push({ text = m.note, by = body.comment.author }) }
  83. return change
  84. }
  85. return { kind = 'ignore', reason = name + '.' + action + ' not handled' }
  86. }

Branches

Latest commits

  • bd3591c7conductor: gates run on the live day44 binarymre
  • 47f747a7records: jukebox #9 fix livemre
  • 0a3169fdMerge branch 'vendored-size' into mainKunibert
  • e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
  • 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
  • 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
  • 50a1867estatus: jukebox #9mre
  • c57484e6log: jukebox #9 diff sizemre
  • 795a20carecords: guard fix live (PR 8)mre
  • 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
  • 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
  • f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
  • 10b2a49estatus: PR 314, guard fix proposedmre
  • e73995a3log: hycon PR 314 approved after fresh reviewmre
  • f60427falog: hycon PR 314 false tool errormre
  • 481974f7log: Hermes accepts PR 259 findingmre
  • bb0976acrecords: hycon PR 259 design findingmre
  • 5c637c24records: hycon PR 259 false tool errormre
  • a344c406log: routger 132 reviewedmre
  • 56e70dcbrecords: review time limit 1800 s (routger 132)mre