[{"data":1,"prerenderedAt":502,"buildId":503},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions":3},{"id":4,"title":5,"body":6,"description":484,"extension":485,"frontmatter":486,"heading":491,"meta":493,"navigation":495,"order":489,"path":496,"seo":497,"sitemap":498,"source":499,"stem":500,"__hash__":501},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions.md","kubb-labs\u002Faction - GitHub Action reference",{"type":7,"value":8,"toc":466},"minimark",[9,27,32,36,46,54,58,188,192,295,299,320,331,335,342,347,353,357,387,391,395,398,410,414,420,463],[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,316,317,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.28.6"," and ",[13,318,319],{},"@kubb\u002Fstudio@^5.28.6",[10,321,322,323,326,327,330],{},"When the repository has no ",[13,324,325],{},"tsdown"," of its own, the action puts a pinned tsdown on ",[13,328,329],{},"PATH"," for the snapshot.",[28,332,334],{"id":333},"pull-request-comment","Pull request comment",[10,336,337,338,341],{},"The comment shows the package name and version, an ",[13,339,340],{},"npm i \u003Ctarball-url>"," command, and the generated file changes against the base branch and since the previous snapshot.",[343,344,346],"blockquote",{"as":345},"tip","The base branch comparison needs a snapshot of the base branch. Run the workflow on pushes to that branch too.",[10,348,48,349,53],{},[22,350,352],{"href":351},"#pull-request-comment-details","Pull request comment details",[28,354,356],{"id":355},"environment-variables","Environment variables",[59,358,359,370],{},[62,360,361],{},[65,362,363,366,368],{},[68,364,365],{},"Variable",[68,367,73],{},[68,369,76],{},[78,371,372],{},[65,373,374,379,384],{},[83,375,376],{},[13,377,378],{},"KUBB_STUDIO_URL",[83,380,381],{},[13,382,383],{},"https:\u002F\u002Fkubb.studio",[83,385,386],{},"Studio URL for a self-hosted deployment",[28,388,390],{"id":389},"less-common-cases","Less common cases",[392,393,52],"h3",{"id":394},"github-action-runs",[10,396,397],{},"These cases apply when the action runs on a pull request.",[37,399,400,403],{},[40,401,402],{},"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,404,405,406,409],{},"When a ",[13,407,408],{},"kubb\u002Finit-*"," pull request is already open, the action stops without opening another.",[411,412,352],"h4",{"id":413},"pull-request-comment-details",[10,415,416,417,419],{},"The comment opens with the package name, version, and an ",[13,418,340],{}," command. Two sections then compare the generated files, each with a collapsed list of up to 50 files:",[59,421,422,435],{},[62,423,424],{},[65,425,426,429,432],{},[68,427,428],{},"Section",[68,430,431],{},"Compares with",[68,433,434],{},"Without a base",[78,436,437,452],{},[65,438,439,442,449],{},[83,440,441],{},"Changes against the base branch",[83,443,444,445,448],{},"The base branch's latest snapshot, from the ",[13,446,447],{},"push"," trigger. The heading links its commit.",[83,450,451],{},"Says to run the workflow on pushes to the base branch",[65,453,454,457,460],{},[83,455,456],{},"Changes since the previous snapshot",[83,458,459],{},"The pull request's previous snapshot. The heading links its commit, or shows its date.",[83,461,462],{},"Reports a first snapshot with its file count",[10,464,465],{},"The comment ends with links to download the package and open the editor, the expiry date, and the source commit.",{"title":467,"searchDepth":468,"depth":468,"links":469},"",5,[470,472,473,474,475,476,477],{"id":30,"depth":471,"text":31},2,{"id":56,"depth":471,"text":57},{"id":190,"depth":471,"text":191},{"id":297,"depth":471,"text":298},{"id":333,"depth":471,"text":334},{"id":355,"depth":471,"text":356},{"id":389,"depth":471,"text":390,"children":478},[479],{"id":394,"depth":480,"text":52,"children":481},3,[482],{"id":413,"depth":483,"text":352},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":487,"title":5,"description":484,"outline":488,"order":489,"navigation":490},"doc",[471,480],8,{"title":491,"icon":492},"GitHub Actions","i-simple-icons-githubactions",{"layout":487,"outline":494},[471,480],{"title":491,"icon":492},"\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions",{"title":5,"description":484},{"loc":496},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions.md","docs\u002F5.x\u002Freference\u002Fgithub-actions","hLghyeqYEOdtd2Q5bSHB8jXBKsZtmaRRX_lnRxxnfkQ",1795989034253,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]