kunibert
All repositories: gitoria
3.8 KB
$mode = 'static'\\ THE ONE FILE that knows gitoria's event names and field paths (apps-api.md v0, section 4).\\ When the contract changes (the [OPEN] marks), only this file changes.headerEvent = 'x-push-event'headerDelivery = 'x-push-delivery'headerSignature = 'x-push-signature-256'signaturePrefix = 'sha256='eventNames = ['ping', 'pull_request', 'review_requested', 'review_comment', 'pull_comment', 'review_thread']botMention = '@kunibert'isKnown = (name) => {return name != null && eventNames.includes(name)}\\ the repo id the secret is keyed by; null when the body has nonerepoId = (body) => {if (body.repo == null || body.repo.id == null) { return null }return '' + body.repo.id}\\ `@kunibert reset` / `@kunibert <text>` at the start of a comment: { reset } or { note } or nullmention = (text) => {if (hlTypeName(text) != 'String') { return null }t = text.trim()if (!t.toLowerCase().startsWith(botMention)) { return null }rest = t.slice(botMention.length).trim()if (rest == '') { return null }if (rest.toLowerCase() == 'reset') { return { reset = true } }return { note = rest }}\\ A change a job can use, from one parsed event. Answer: { kind, reason, ... }\\ kind: 'ignore' | 'ping' | 'review' | 'thread-state' | 'close'\\ A review/thread-state change carries: repo, number, head, time, pull, force, reset, threads, notes, replyCandidate.\\ review: starts or updates a review job. thread-state: only records a resolved/settled flip (no review).\\ replyCandidate: a review_comment; the queue makes it threadReplyOnly when it brings no new head.classify = (String name, Hybrid body) => {action = body.actionpull = body.pullif (name == 'ping') { return { kind = 'ping' } }if (pull == null || pull.number == null || repoId(body) == null) { return { kind = 'ignore', reason = 'no repo.id or pull.number' } }change = {kind = 'review'repoId = repoId(body)repo = body.reponumber = pull.numberhead = pull.headtime = body.timepull = pullforce = falsereset = falsethreads = []notes = []delivery = body.deliveryevent = name + '.' + actionreplyCandidate = false}if (name == 'pull_request') {if (action == 'closed' || action == 'merged') { change.kind = 'close'return change }if (pull.draft == true) { return { kind = 'ignore', reason = 'draft pull request' } }if (action == 'opened' || action == 'reopened' || action == 'synchronize' || action == 'ready') { return change }return { kind = 'ignore', reason = 'pull_request.' + action + ' not handled' }}if (pull.draft == true) { return { kind = 'ignore', reason = 'draft pull request' } }if (name == 'review_requested') {change.reset = truechange.force = truereturn change}if (name == 'review_comment' && action == 'created') {change.threads.push({ event = 'review_comment.created', thread = body.thread, comment = body.comment })change.replyCandidate = truereturn change}if (name == 'review_thread' && (action == 'resolved' || action == 'unresolved')) {change.threads.push({ event = 'review_thread.' + action, thread = body.thread })change.kind = 'thread-state'return change}if (name == 'pull_comment' && action == 'created') {let m = nullif (body.comment != null) { m = mention(body.comment.body) }if (m == null) { return { kind = 'ignore', reason = 'comment without @kunibert' } }if (m.reset) { change.reset = true change.force = true }if (m.note != null) { change.force = true change.notes.push({ text = m.note, by = body.comment.author }) }return change}return { kind = 'ignore', reason = name + '.' + action + ' not handled' }}
Branches
Latest commits
- 1aa4d64crecords: HL-STANDARD L10 update livemre
- 2b04c240Merge branch 'hl-standard-l10' into mainKunibert
- 88c7b09d|||PR HL-STANDARD L10 update (hybriel 5885d688), rules version 3mre
- 00869ecbrecords: gitoria#50 step 3 livemre
- f97a0e5fMerge branch 'hl-standard' into mainKunibert
- 9710e39fType STANDARD as String (L10, Kunibert review)mre
- 4140b664|||PR Review against HL-STANDARD and cite rule ids (gitoria#50 step 3)mre
- 75c6888drecords: gitoria#50 step 1 connected and provenmre
- aa6d997frecords: gitoria#50 connect plan, Anton reportmre
- 8a190ba7Records: kunibert#18 and #15 donemre
- 2eee9dbbMerge branch 'revendor-day44' into mainKunibert
- e96721cb|||PR Re-vendor plugins from Hybriel day44 (hl:fetch redirect fix)mre
- 0c67ab8cLog: kunibert repo ping provenmre
- b6f3039cLog: kunibert repo connectedmre
- 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