[{"data":1,"prerenderedAt":427},["ShallowReactive",2],{"navigation_docs":3,"-examples-label-bot":195,"-examples-label-bot-surround":422},[4,23,65,87,133,155,173],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":22},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",false,{"title":24,"icon":25,"path":26,"stem":27,"children":28,"page":22},"Guides","i-lucide-compass","\u002Fguides","2.guides",[29,33,37,41,45,49,53,57,61],{"title":30,"path":31,"stem":32},"Authenticate","\u002Fguides\u002Fauthentication","2.guides\u002F1.authentication",{"title":34,"path":35,"stem":36},"Work with several forges","\u002Fguides\u002Fmultiple-forges","2.guides\u002F2.multiple-forges",{"title":38,"path":39,"stem":40},"Configure from the environment","\u002Fguides\u002Fenvironment","2.guides\u002F3.environment",{"title":42,"path":43,"stem":44},"Receive webhooks","\u002Fguides\u002Fwebhooks","2.guides\u002F4.webhooks",{"title":46,"path":47,"stem":48},"Check what a forge supports","\u002Fguides\u002Fcapabilities","2.guides\u002F5.capabilities",{"title":50,"path":51,"stem":52},"Handle errors and rate limits","\u002Fguides\u002Ferrors","2.guides\u002F6.errors",{"title":54,"path":55,"stem":56},"Page through results","\u002Fguides\u002Fpagination","2.guides\u002F7.pagination",{"title":58,"path":59,"stem":60},"Browser bundles","\u002Fguides\u002Fbundling","2.guides\u002F8.bundling",{"title":62,"path":63,"stem":64},"Test your code","\u002Fguides\u002Ftesting","2.guides\u002F9.testing",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":22},"Concepts","i-lucide-lightbulb","\u002Fconcepts","3.concepts",[71,75,79,83],{"title":72,"path":73,"stem":74},"Data model","\u002Fconcepts\u002Fdata-model","3.concepts\u002F1.data-model",{"title":76,"path":77,"stem":78},"Capabilities","\u002Fconcepts\u002Fcapabilities","3.concepts\u002F2.capabilities",{"title":80,"path":81,"stem":82},"Providers and factories","\u002Fconcepts\u002Fproviders","3.concepts\u002F3.providers",{"title":84,"path":85,"stem":86},"Events","\u002Fconcepts\u002Fevents","3.concepts\u002F4.events",{"title":88,"icon":89,"path":90,"stem":91,"children":92,"page":22},"Providers","i-lucide-server","\u002Fproviders","4.providers",[93,97,101,105,109,113,117,121,125,129],{"title":94,"path":95,"stem":96},"Azure DevOps","\u002Fproviders\u002Fazure-devops","4.providers\u002Fazure-devops",{"title":98,"path":99,"stem":100},"Bitbucket Cloud","\u002Fproviders\u002Fbitbucket","4.providers\u002Fbitbucket",{"title":102,"path":103,"stem":104},"Cursor Origin","\u002Fproviders\u002Fcursor-origin","4.providers\u002Fcursor-origin",{"title":106,"path":107,"stem":108},"Forgejo and Codeberg","\u002Fproviders\u002Fforgejo","4.providers\u002Fforgejo",{"title":110,"path":111,"stem":112},"Gitea","\u002Fproviders\u002Fgitea","4.providers\u002Fgitea",{"title":114,"path":115,"stem":116},"Gitee","\u002Fproviders\u002Fgitee","4.providers\u002Fgitee",{"title":118,"path":119,"stem":120},"GitHub","\u002Fproviders\u002Fgithub","4.providers\u002Fgithub",{"title":122,"path":123,"stem":124},"GitLab","\u002Fproviders\u002Fgitlab","4.providers\u002Fgitlab",{"title":126,"path":127,"stem":128},"pushin.eu","\u002Fproviders\u002Fpushin","4.providers\u002Fpushin",{"title":130,"path":131,"stem":132},"Tangled","\u002Fproviders\u002Ftangled","4.providers\u002Ftangled",{"title":134,"icon":135,"path":136,"stem":137,"children":138,"page":22},"Reference","i-lucide-book-marked","\u002Freference","5.reference",[139,143,147,151],{"title":140,"path":141,"stem":142},"Provider API","\u002Freference\u002Fprovider-api","5.reference\u002F1.provider-api",{"title":144,"path":145,"stem":146},"Capability matrix","\u002Freference\u002Fcapability-matrix","5.reference\u002F2.capability-matrix",{"title":148,"path":149,"stem":150},"Errors","\u002Freference\u002Ferrors","5.reference\u002F3.errors",{"title":152,"path":153,"stem":154},"JSON Schemas","\u002Freference\u002Fjson-schemas","5.reference\u002F5.json-schemas",{"title":156,"icon":157,"path":158,"stem":159,"children":160,"page":22},"Examples","i-lucide-boxes","\u002Fexamples","6.examples",[161,165,169],{"title":162,"path":163,"stem":164},"Inbox CLI","\u002Fexamples\u002Finbox-cli","6.examples\u002F1.inbox-cli",{"title":166,"path":167,"stem":168},"Label bot","\u002Fexamples\u002Flabel-bot","6.examples\u002F2.label-bot",{"title":170,"path":171,"stem":172},"Release digest","\u002Fexamples\u002Frelease-digest","6.examples\u002F3.release-digest",{"title":174,"icon":175,"path":176,"stem":177,"children":178,"page":22},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","7.contributing",[179,183,187,191],{"title":180,"path":181,"stem":182},"Contribution guide","\u002Fcontributing\u002Fguidelines","7.contributing\u002F1.guidelines",{"title":184,"path":185,"stem":186},"Write a provider","\u002Fcontributing\u002Fwrite-a-provider","7.contributing\u002F2.write-a-provider",{"title":188,"path":189,"stem":190},"Record fixtures","\u002Fcontributing\u002Frecord-fixtures","7.contributing\u002F3.record-fixtures",{"title":192,"path":193,"stem":194},"Contributors","\u002Fcontributing\u002Fcontributors","7.contributing\u002F4.contributors",{"id":196,"title":166,"body":197,"description":414,"extension":415,"links":416,"meta":417,"navigation":419,"path":167,"seo":420,"stem":168,"__hash__":421},"docs\u002F6.examples\u002F2.label-bot.md",{"type":198,"value":199,"toc":408},"minimark",[200,216,230,241,246,287,301,315,322,339,343,353,357,377,381,390,404],[201,202,203,207,208,215],"p",{},[204,205,206],"code",{},"label-bot"," is a webhook receiver that works with any configured forge. ",[209,210,214],"a",{"href":211,"rel":212},"https:\u002F\u002Fgithub.com\u002Fdanielroe\u002Fforges\u002Ftree\u002Fmain\u002Fexamples\u002Flabel-bot",[213],"nofollow","View the source",". It does two things:",[217,218,219,223],"ul",{},[220,221,222],"li",{},"When an issue or pull request opens with a title that matches a pattern, the bot adds a label and posts a comment.",[220,224,225,226,229],{},"When a comment contains ",[204,227,228],{},"\u002Fclose",", the bot closes the thread if the commenter has write access to the repository.",[201,231,232,233,236,237,240],{},"The bot calls ",[204,234,235],{},"provider.can()"," before each write. On a forge that can't add labels, such as Bitbucket or Tangled, the bot posts the comment and reports the label as ",[204,238,239],{},"unsupported"," in its response.",[242,243,245],"h2",{"id":244},"run-it","Run it",[247,248,253],"pre",{"className":249,"code":250,"language":251,"meta":252,"style":252},"language-sh shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","FORGES_GITHUB_TOKEN=ghp_... \\\nFORGES_GITHUB_WEBHOOK_SECRET=... \\\nLABEL_BOT_PATTERN='^(feat|fix)[(:]' \\\nLABEL_BOT_LABEL=triage \\\npnpm --filter @forges-examples\u002Flabel-bot start\n","sh","",[204,254,255,263,269,275,281],{"__ignoreMap":252},[256,257,260],"span",{"class":258,"line":259},"line",1,[256,261,262],{},"FORGES_GITHUB_TOKEN=ghp_... \\\n",[256,264,266],{"class":258,"line":265},2,[256,267,268],{},"FORGES_GITHUB_WEBHOOK_SECRET=... \\\n",[256,270,272],{"class":258,"line":271},3,[256,273,274],{},"LABEL_BOT_PATTERN='^(feat|fix)[(:]' \\\n",[256,276,278],{"class":258,"line":277},4,[256,279,280],{},"LABEL_BOT_LABEL=triage \\\n",[256,282,284],{"class":258,"line":283},5,[256,285,286],{},"pnpm --filter @forges-examples\u002Flabel-bot start\n",[201,288,289,292,293,296,297,300],{},[204,290,291],{},"LABEL_BOT_COMMENT"," sets the text of the comment. ",[204,294,295],{},"PORT"," sets the port, which defaults to ",[204,298,299],{},"3000",".",[201,302,303,304,307,308,311,312,300],{},"Point the forge's webhook at ",[204,305,306],{},"http:\u002F\u002F\u003Chost>:3000\u002Fwebhooks\u002F\u003Cforge>",", for example ",[204,309,310],{},"\u002Fwebhooks\u002Fgithub",". If you configure several instances of the same forge, add the instance host to the path: ",[204,313,314],{},"\u002Fwebhooks\u002Fgitlab\u002Fgitlab.example.com",[201,316,317,318,321],{},"If a delivery's signature doesn't verify, the bot responds with ",[204,319,320],{},"401",". For any other delivery, it responds with a JSON list of the actions it took.",[201,323,324,327,328,331,332,335,336,300],{},[204,325,326],{},"src\u002Fhandler.ts"," exports a ",[204,329,330],{},"(request: Request) => Promise\u003CResponse>"," handler, so it runs on any runtime that supports the Fetch API. ",[204,333,334],{},"src\u002Fserver.ts"," serves the handler with ",[204,337,338],{},"node:http",[242,340,342],{"id":341},"collaborator-checks","Collaborator checks",[201,344,345,346,349,350,352],{},"Before the bot closes a thread, it calls ",[204,347,348],{},"repos.permissionFor()"," to read the commenter's role. On a forge with no collaborator API, the bot reports ",[204,351,239],{}," and leaves the thread open.",[242,354,356],{"id":355},"what-it-shows","What it shows",[217,358,359,365,371],{},[220,360,361,364],{},[209,362,363],{"href":43},"Receiving webhooks"," for several forges with one handler.",[220,366,367,370],{},[209,368,369],{"href":47},"Checking capabilities"," before each write.",[220,372,373,374,300],{},"Signing deliveries in tests with ",[204,375,376],{},"hmacSha256Hex()",[242,378,380],{"id":379},"run-the-tests","Run the tests",[247,382,384],{"className":249,"code":383,"language":251,"meta":252,"style":252},"pnpm --filter @forges-examples\u002Flabel-bot test\n",[204,385,386],{"__ignoreMap":252},[256,387,388],{"class":258,"line":259},[256,389,383],{},[201,391,392,393,395,396,399,400,403],{},"The tests sign deliveries with ",[204,394,376],{}," from ",[204,397,398],{},"forges",". They serve responses from the fixtures in ",[204,401,402],{},"test\u002Ffixtures\u002Fgithub\u002F",", without a network connection.",[405,406,407],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":252,"searchDepth":265,"depth":265,"links":409},[410,411,412,413],{"id":244,"depth":265,"text":245},{"id":341,"depth":265,"text":342},{"id":355,"depth":265,"text":356},{"id":379,"depth":265,"text":380},"A webhook receiver that labels new threads and closes them from a comment command.","md",null,{"icon":418},"i-lucide-tag",true,{"title":166,"description":414},"QyczjZusVDGbDYc3-n_tcG5K39V9O8V0NHiTlW8g0tA",[423,425],{"title":162,"path":163,"stem":164,"description":424,"children":-1},"A command-line inbox for the notifications of every forge you configure.",{"title":170,"path":171,"stem":172,"description":426,"children":-1},"Print the latest release and the failing pull requests of repositories on any forge.",1791294003829]