[{"data":1,"prerenderedAt":494,"buildId":495},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions":3},{"id":4,"title":5,"body":6,"description":476,"extension":477,"frontmatter":478,"heading":483,"meta":485,"navigation":487,"order":481,"path":488,"seo":489,"sitemap":490,"source":491,"stem":492,"__hash__":493},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions.md","kubb-labs\u002Faction - GitHub Action reference",{"type":7,"value":8,"toc":458},"minimark",[9,27,32,36,46,54,58,188,192,295,299,323,327,334,339,345,349,379,383,387,390,402,406,412,455],[10,11,12,16,17,20,21,26],"p",{},[13,14,15],"code",{},"kubb-labs\u002Faction@v0"," publishes a Studio snapshot with ",[13,18,19],{},"kubb studio snapshot",", then writes the result on the pull request. ",[22,23,25],"a",{"href":24},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions","Publish Kubb snapshots with GitHub Actions"," has the workflow and its permissions.",[28,29,31],"h2",{"id":30},"run-flow","Run flow",[33,34],"mermaid",{"svg":35},"\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"pele pele-flowchart\" viewBox=\"0 0 705 1011\" width=\"705\" height=\"1011\" style=\"--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,monospace);font:16px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,sans-serif)\" fill=\"var(--_fg)\" role=\"graphics-document document\" aria-roledescription=\"flowchart\">\u003Cg class=\"pele-edges\" fill=\"none\" stroke=\"var(--_l)\" stroke-linecap=\"round\">\u003Cg class=\"pele-edge\" data-id=\"L_event_fork_0\">\u003Cpath d=\"M249.2,56L249.2,97\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M249.2,104L245.84,96L252.56,96Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_fork_skip_0\">\u003Cpath d=\"M216.75,234.65C216.75,255.04 120.26,255.04 120.26,275.43L120.26,353.95\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M120.26,360.95L116.9,352.95L123.62,352.95Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_fork_closed_0\">\u003Cpath d=\"M281.65,234.65C281.65,255.04 378.14,255.04 378.14,275.43L378.14,320.93\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M378.14,327.93L374.78,319.93L381.5,319.93Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_closed_release_0\">\u003Cpath d=\"M354.76,445.36C354.76,462.91 268.1,462.91 268.1,480.47L268.1,562.15\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M268.1,569.15L264.74,561.15L271.46,561.15Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_closed_cfg_0\">\u003Cpath d=\"M401.52,445.36C401.52,462.91 488.19,462.91 488.19,480.47L488.19,525.97\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M488.19,532.97L484.83,524.97L491.55,524.97Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_cfg_init_0\">\u003Cpath d=\"M470.42,642.22C470.42,658.03 373.04,658.03 373.04,673.83L373.04,719.33\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M373.04,726.33L369.68,718.33L376.4,718.33Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_cfg_snap_0\">\u003Cpath d=\"M505.96,642.22C505.96,658.03 603.34,658.03 603.34,673.83L603.34,728.33\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M603.34,735.33L599.98,727.33L606.7,727.33Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_snap_outputs_0\">\u003Cpath d=\"M603.34,783.33L603.34,833.33\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M603.34,840.33L599.98,832.33L606.7,832.33Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_outputs_comment_0\">\u003Cpath d=\"M603.34,888.33L603.34,929.33\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M603.34,936.33L599.98,928.33L606.7,928.33Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-edge-labels\" font-size=\"14\">\u003Cg class=\"pele-edge-label\" data-id=\"L_fork_skip_0\">\u003Crect x=\"105.36\" y=\"277.43\" width=\"29.78\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"120.26\" y=\"292.83\" text-anchor=\"middle\">yes\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_fork_closed_0\">\u003Crect x=\"366.36\" y=\"277.43\" width=\"23.57\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"378.14\" y=\"292.83\" text-anchor=\"middle\">no\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_closed_release_0\">\u003Crect x=\"253.2\" y=\"482.47\" width=\"29.78\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"268.1\" y=\"497.87\" text-anchor=\"middle\">yes\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_closed_cfg_0\">\u003Crect x=\"476.41\" y=\"482.47\" width=\"23.57\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"488.19\" y=\"497.87\" text-anchor=\"middle\">no\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_cfg_init_0\">\u003Crect x=\"361.26\" y=\"675.83\" width=\"23.57\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"373.04\" y=\"691.23\" text-anchor=\"middle\">no\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-edge-label\" data-id=\"L_cfg_snap_0\">\u003Crect x=\"588.45\" y=\"675.83\" width=\"29.78\" height=\"21\" rx=\"3\" fill=\"var(--_bg)\"\u002F>\u003Ctext x=\"603.34\" y=\"691.23\" text-anchor=\"middle\">yes\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-nodes\">\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"event\" transform=\"translate(249.2,32)\">\u003Crect x=\"-64.67\" y=\"-24\" width=\"129.34\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Workflow run\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-diam\" data-id=\"fork\" transform=\"translate(249.2,179.47)\">\u003Cpolygon points=\"0,-75.46 120.74,0 0,75.47 -120.74,0\" fill=\"var(--_s)\" stroke=\"var(--_b)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Pull request from a fork?\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"skip\" transform=\"translate(120.26,393.95)\">\u003Crect x=\"-112.26\" y=\"-33\" width=\"224.51\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">Skip: GitHub hides secrets\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">from forks\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-diam\" data-id=\"closed\" transform=\"translate(378.14,393.95)\">\u003Cpolygon points=\"0,-66.02 105.63,0 0,66.02 -105.63,0\" fill=\"var(--_s)\" stroke=\"var(--_b)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Pull request closed?\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"release\" transform=\"translate(268.1,593.15)\">\u003Crect x=\"-83.81\" y=\"-24\" width=\"167.62\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Delete its CI agent\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-diam\" data-id=\"cfg\" transform=\"translate(488.19,593.15)\">\u003Cpolygon points=\"0,-60.18 96.29,0 0,60.18 -96.29,0\" fill=\"var(--_s)\" stroke=\"var(--_b)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Config file exists?\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"init\" transform=\"translate(373.04,759.33)\">\u003Crect x=\"-96.7\" y=\"-33\" width=\"193.41\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">Open a kubb\u002Finit-* pull\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">request, then stop\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect core\" data-id=\"snap\" transform=\"translate(603.34,759.33)\">\u003Crect x=\"-93.6\" y=\"-24\" width=\"187.2\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">kubb studio snapshot\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"outputs\" transform=\"translate(603.34,864.33)\">\u003Crect x=\"-71.82\" y=\"-24\" width=\"143.63\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">Set the outputs\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"comment\" transform=\"translate(603.34,969.33)\">\u003Crect x=\"-93.58\" y=\"-33\" width=\"187.17\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">Write the pull request\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">comment\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[37,38,39,43],"ul",{},[40,41,42],"li",{},"Each pull request reuses one CI agent and one comment. Each branch push reuses one CI agent and writes no comment.",[40,44,45],{},"When the snapshot fails, the comment shows the error and links the workflow run, and the step fails.",[10,47,48,49,53],{},"See ",[22,50,52],{"href":51},"#github-action-runs","GitHub Action runs",".",[28,55,57],{"id":56},"inputs","Inputs",[59,60,61,77],"table",{},[62,63,64],"thead",{},[65,66,67,71,74],"tr",{},[68,69,70],"th",{},"Input",[68,72,73],{},"Default",[68,75,76],{},"What it does",[78,79,80,96,115,132,149,167],"tbody",{},[65,81,82,88,90],{},[83,84,85],"td",{},[13,86,87],{},"token",[83,89],{},[83,91,92,93,53],{},"Required. The organization CI API key. The action masks it in logs and passes it to the CLI as ",[13,94,95],{},"KUBB_TOKEN",[65,97,98,103,112],{},[83,99,100],{},[13,101,102],{},"github-token",[83,104,105],{},[13,106,111],{"$":107,"v-pre":110},{"html":108,"block":109},1,0,true,"${{ github.token }}",[83,113,114],{},"Token that opens the init pull request and writes the comment.",[65,116,117,122,126],{},[83,118,119],{},[13,120,121],{},"working-directory",[83,123,124],{},[13,125,53],{},[83,127,128,129,53],{},"Folder that holds the Kubb config and ",[13,130,131],{},"package.json",[65,133,134,139,144],{},[83,135,136],{},[13,137,138],{},"config",[83,140,141],{},[13,142,143],{},"kubb.config.ts",[83,145,146,147,53],{},"Config file path, relative to ",[13,148,121],{},[65,150,151,156,164],{},[83,152,153],{},[13,154,155],{},"package-name",[83,157,158,161,162],{},[13,159,160],{},"name"," in ",[13,163,131],{},[83,165,166],{},"Package name of the snapshot.",[65,168,169,174,181],{},[83,170,171],{},[13,172,173],{},"package-version",[83,175,176,161,179],{},[13,177,178],{},"version",[13,180,131],{},[83,182,183,184,53],{},"Package version of the snapshot, such as ",[13,185,187],{"$":186,"v-pre":110},{"html":108,"block":109},"0.0.0-pr.${{ github.event.pull_request.number }}",[28,189,191],{"id":190},"outputs","Outputs",[59,193,194,204],{},[62,195,196],{},[65,197,198,201],{},[68,199,200],{},"Output",[68,202,203],{},"Value",[78,205,206,216,225,234,244,254,264,274],{},[65,207,208,213],{},[83,209,210],{},[13,211,212],{},"snapshot-id",[83,214,215],{},"The id Studio stores the snapshot under",[65,217,218,222],{},[83,219,220],{},[13,221,155],{},[83,223,224],{},"The package name",[65,226,227,231],{},[83,228,229],{},[13,230,173],{},[83,232,233],{},"The package version",[65,235,236,241],{},[83,237,238],{},[13,239,240],{},"tarball-url",[83,242,243],{},"The URL of the package tarball",[65,245,246,251],{},[83,247,248],{},[13,249,250],{},"integrity",[83,252,253],{},"The SHA-512 integrity of the tarball",[65,255,256,261],{},[83,257,258],{},[13,259,260],{},"agent-url",[83,262,263],{},"The Studio URL of the CI agent that holds the snapshot",[65,265,266,271],{},[83,267,268],{},[13,269,270],{},"editor-url",[83,272,273],{},"The read-only Studio editor for the output",[65,275,276,288],{},[83,277,278,281,282,281,285],{},[13,279,280],{},"files-added",", ",[13,283,284],{},"files-changed",[13,286,287],{},"files-removed",[83,289,290,291,294],{},"Generated files added, changed, and removed since the previous snapshot on the pull request. ",[13,292,293],{},"0"," when there is none.",[28,296,298],{"id":297},"kubb-version","Kubb version",[10,300,301,302,305,306,308,309,312,313,281,316,319,320,53],{},"The action runs ",[13,303,304],{},"node_modules\u002F.bin\u002Fkubb"," from ",[13,307,121],{},", so the snapshot uses the Kubb version your config and plugins are built against. That install must be Kubb 5.6.2 or later. Without one, the action runs ",[13,310,311],{},"npx"," with ",[13,314,315],{},"@kubb\u002Fcli@^5.16.0",[13,317,318],{},"@kubb\u002Fstudio@^5.16.0",", and ",[13,321,322],{},"tsdown@^0.23.1",[28,324,326],{"id":325},"pull-request-comment","Pull request comment",[10,328,329,330,333],{},"The comment shows the package name and version, an ",[13,331,332],{},"npm i \u003Ctarball-url>"," command, and the generated file changes against the base branch and since the previous snapshot.",[335,336,338],"blockquote",{"as":337},"tip","The base branch comparison needs a snapshot of the base branch. Run the workflow on pushes to that branch too.",[10,340,48,341,53],{},[22,342,344],{"href":343},"#pull-request-comment-details","Pull request comment details",[28,346,348],{"id":347},"environment-variables","Environment variables",[59,350,351,362],{},[62,352,353],{},[65,354,355,358,360],{},[68,356,357],{},"Variable",[68,359,73],{},[68,361,76],{},[78,363,364],{},[65,365,366,371,376],{},[83,367,368],{},[13,369,370],{},"KUBB_STUDIO_URL",[83,372,373],{},[13,374,375],{},"https:\u002F\u002Fkubb.studio",[83,377,378],{},"Studio URL for a self-hosted deployment",[28,380,382],{"id":381},"less-common-cases","Less common cases",[384,385,52],"h3",{"id":386},"github-action-runs",[10,388,389],{},"These cases apply when the action runs on a pull request.",[37,391,392,395],{},[40,393,394],{},"Deleting a closed pull request's agent is best effort. If the delete fails, the action logs a warning. Studio's idle cleanup removes the agent later.",[40,396,397,398,401],{},"When a ",[13,399,400],{},"kubb\u002Finit-*"," pull request is already open, the action stops without opening another.",[403,404,344],"h4",{"id":405},"pull-request-comment-details",[10,407,408,409,411],{},"The comment opens with the package name, version, and an ",[13,410,332],{}," command. Two sections then compare the generated files, each with a collapsed list of up to 50 files:",[59,413,414,427],{},[62,415,416],{},[65,417,418,421,424],{},[68,419,420],{},"Section",[68,422,423],{},"Compares with",[68,425,426],{},"Without a base",[78,428,429,444],{},[65,430,431,434,441],{},[83,432,433],{},"Changes against the base branch",[83,435,436,437,440],{},"The base branch's latest snapshot, from the ",[13,438,439],{},"push"," trigger. The heading links its commit.",[83,442,443],{},"Says to run the workflow on pushes to the base branch",[65,445,446,449,452],{},[83,447,448],{},"Changes since the previous snapshot",[83,450,451],{},"The pull request's previous snapshot. The heading links its commit, or shows its date.",[83,453,454],{},"Reports a first snapshot with its file count",[10,456,457],{},"The comment ends with links to download the package and open the editor, the expiry date, and the source commit.",{"title":459,"searchDepth":460,"depth":460,"links":461},"",5,[462,464,465,466,467,468,469],{"id":30,"depth":463,"text":31},2,{"id":56,"depth":463,"text":57},{"id":190,"depth":463,"text":191},{"id":297,"depth":463,"text":298},{"id":325,"depth":463,"text":326},{"id":347,"depth":463,"text":348},{"id":381,"depth":463,"text":382,"children":470},[471],{"id":386,"depth":472,"text":52,"children":473},3,[474],{"id":405,"depth":475,"text":344},4,"Reference for kubb-labs\u002Faction. Its inputs, outputs, run flow, the Kubb version it runs, and the snapshot comment it writes on pull requests.","md",{"layout":479,"title":5,"description":476,"outline":480,"order":481,"navigation":482},"doc",[463,472],8,{"title":483,"icon":484},"GitHub Actions","i-simple-icons-githubactions",{"layout":479,"outline":486},[463,472],{"title":483,"icon":484},"\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions",{"title":5,"description":476},{"loc":488},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions.md","docs\u002F5.x\u002Freference\u002Fgithub-actions","Y3Zog1RmGWaUtHs0urHbI5bVz2Dp64PNvcuH8UF2LmY",1795727675332,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]