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
- 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