[{"data":1,"prerenderedAt":392,"buildId":393},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions":3},{"id":4,"title":5,"body":6,"description":376,"extension":377,"frontmatter":378,"heading":5,"meta":384,"navigation":385,"order":380,"path":386,"seo":387,"sitemap":388,"source":389,"stem":390,"__hash__":391},"docs\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions.md","Publish Kubb snapshots with GitHub Actions",{"type":7,"value":8,"toc":370},"minimark",[9,33,38,44,294,299,347,358],[10,11,12,13,18,19,23,24,28,29,32],"p",{},"The ",[14,15,17],"a",{"href":16},"https:\u002F\u002Fgithub.com\u002Fkubb-labs\u002Faction","kubb-labs\u002Faction"," publishes a Studio snapshot on each pull request. Its comment lists the generated files that changed against the base branch and the previous run. Meet the ",[14,20,22],{"href":21},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci#prerequisites","prerequisites"," first: Kubb 5.6.2 or later, ",[25,26,27],"code",{},"tsdown",", and a CI key stored as ",[25,30,31],{},"KUBB_TOKEN",".",[34,35,37],"h2",{"id":36},"add-the-workflow","Add the workflow",[10,39,40,41,43],{},"Store ",[25,42,31],{}," as an Actions repository secret, then add this workflow:",[45,46,51],"pre",{"language":47,"filename":48,"code":49,"class":50},"yaml",".github\u002Fworkflows\u002Fkubb.yml","name: Kubb snapshot\n\non:\n pull_request:\n # `closed` deletes the pull request's Studio agent. GitHub leaves it out by default.\n types: [opened, synchronize, reopened, closed]\n # Each pull request compares with a snapshot of its base branch, so list every branch pull requests target.\n push:\n branches: [main, 'release\u002F**']\n\npermissions:\n contents: write\n pull-requests: write\n\njobs:\n snapshot:\n runs-on: ubuntu-latest\n steps:\n - uses: actions\u002Fcheckout@v5\n - uses: kubb-labs\u002Faction@v0\n with:\n token: ${{ secrets.KUBB_TOKEN }}","highlights",[25,52,54,71,72,71,74,71,82,71,92,71,101,71,135,71,142,71,151,71,172,71,174,71,181,71,193,71,204,71,206,71,213,71,222,71,234,71,243,71,256,71,271,71,281],{"class":53},"language-yaml",[55,56,59,63,67],"span",{"class":57,"style":58},"line","display: inline",[55,60,62],{"style":61},"color:#005cc5;--hls-dark:#79b8ff","name",[55,64,66],{"style":65},"color:#d73a49;--hls-dark:#f97583",": ",[55,68,70],{"style":69},"color:#032f62;--hls-dark:#9ecbff","Kubb snapshot","\n",[55,73],{"class":57,"style":58},[55,75,76,79],{"class":57,"style":58},[55,77,78],{"style":61},"on",[55,80,81],{"style":65},":",[55,83,84,87,90],{"class":57,"style":58},[55,85,86],{"style":65}," ",[55,88,89],{"style":61},"pull_request",[55,91,81],{"style":65},[55,93,94,97],{"class":57,"style":58},[55,95,96],{"style":65}," ",[55,98,100],{"style":99},"color:#6a737d;--hls-dark:#6a737d","# `closed` deletes the pull request's Studio agent. GitHub leaves it out by default.",[55,102,103,105,108,110,113,116,119,122,124,127,129,132],{"class":57,"style":58},[55,104,96],{"style":99},[55,106,107],{"style":61},"types",[55,109,66],{"style":65},[55,111,112],{"style":61},"[",[55,114,115],{"style":69},"opened",[55,117,118],{"style":65},", ",[55,120,121],{"style":69},"synchronize",[55,123,118],{"style":65},[55,125,126],{"style":69},"reopened",[55,128,118],{"style":65},[55,130,131],{"style":69},"closed",[55,133,134],{"style":61},"]",[55,136,137,139],{"class":57,"style":58},[55,138,86],{"style":61},[55,140,141],{"style":99},"# Each pull request compares with a snapshot of its base branch, so list every branch pull requests target.",[55,143,144,146,149],{"class":57,"style":58},[55,145,86],{"style":99},[55,147,148],{"style":61},"push",[55,150,81],{"style":65},[55,152,153,155,158,160,162,165,167,170],{"class":57,"style":58},[55,154,96],{"style":65},[55,156,157],{"style":61},"branches",[55,159,66],{"style":65},[55,161,112],{"style":61},[55,163,164],{"style":69},"main",[55,166,118],{"style":65},[55,168,169],{"style":69},"'release\u002F**'",[55,171,134],{"style":61},[55,173],{"class":57,"style":58},[55,175,176,179],{"class":57,"style":58},[55,177,178],{"style":61},"permissions",[55,180,81],{"style":65},[55,182,183,185,188,190],{"class":57,"style":58},[55,184,86],{"style":65},[55,186,187],{"style":61},"contents",[55,189,66],{"style":65},[55,191,192],{"style":69},"write",[55,194,195,197,200,202],{"class":57,"style":58},[55,196,86],{"style":69},[55,198,199],{"style":61},"pull-requests",[55,201,66],{"style":65},[55,203,192],{"style":69},[55,205],{"class":57,"style":58},[55,207,208,211],{"class":57,"style":58},[55,209,210],{"style":61},"jobs",[55,212,81],{"style":65},[55,214,215,217,220],{"class":57,"style":58},[55,216,86],{"style":65},[55,218,219],{"style":61},"snapshot",[55,221,81],{"style":65},[55,223,224,226,229,231],{"class":57,"style":58},[55,225,96],{"style":65},[55,227,228],{"style":61},"runs-on",[55,230,66],{"style":65},[55,232,233],{"style":69},"ubuntu-latest",[55,235,236,238,241],{"class":57,"style":58},[55,237,96],{"style":69},[55,239,240],{"style":61},"steps",[55,242,81],{"style":65},[55,244,245,248,251,253],{"class":57,"style":58},[55,246,247],{"style":65}," - ",[55,249,250],{"style":61},"uses",[55,252,66],{"style":65},[55,254,255],{"style":69},"actions\u002Fcheckout@v5",[55,257,258,261,264,266,268],{"class":57,"style":58},[55,259,260],{"style":69}," ",[55,262,263],{"style":65},"- ",[55,265,250],{"style":61},[55,267,66],{"style":65},[55,269,270],{"style":69},"kubb-labs\u002Faction@v0",[55,272,273,276,279],{"class":57,"style":58},[55,274,275],{"style":69}," ",[55,277,278],{"style":61},"with",[55,280,81],{"style":65},[55,282,283,286,289,291],{"class":57,"style":58},[55,284,285],{"style":65}," ",[55,287,288],{"style":61},"token",[55,290,66],{"style":65},[55,292,293],{"style":69},"${{ secrets.KUBB_TOKEN }}",[295,296,298],"blockquote",{"as":297},"note","GitHub does not give secrets to workflows from fork pull requests, so the action skips the snapshot on those and logs why. Pull requests from branches in the repository get a snapshot.",[300,301,302,315],"table",{},[303,304,305],"thead",{},[306,307,308,312],"tr",{},[309,310,311],"th",{},"Permission",[309,313,314],{},"Lets the action",[316,317,318,329],"tbody",{},[306,319,320,326],{},[321,322,323],"td",{},[25,324,325],{},"pull-requests: write",[321,327,328],{},"Post and update the snapshot comment.",[306,330,331,336],{},[321,332,333],{},[25,334,335],{},"contents: write",[321,337,338,339,343,344,32],{},"Open an initialization pull request when the repository has no Kubb config. Also turn on ",[340,341,342],"strong",{},"Allow GitHub Actions to create and approve pull requests"," under ",[340,345,346],{},"Settings › Actions › General",[10,348,12,349,353,354,357],{},[14,350,352],{"href":351},"\u002Fdocs\u002F5.x\u002Freference\u002Fgithub-actions","GitHub Action reference"," lists inputs, outputs such as ",[25,355,356],{},"tarball-url",", and runtime behavior.",[10,359,360,361,365,366,32],{},"To install a snapshot or read it in Studio, see ",[14,362,364],{"href":363},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci#review-the-snapshot","Review the snapshot"," and ",[14,367,369],{"href":368},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci#install-the-snapshot","Install the snapshot",{"title":371,"searchDepth":372,"depth":372,"links":373},"",5,[374],{"id":36,"depth":375,"text":37},2,"Add the kubb-labs\u002Faction workflow to publish a Kubb Studio snapshot on each pull request and compare generated files with the base branch and the previous run.","md",{"layout":379,"title":5,"description":376,"order":380,"navigation":381},"doc",3,{"title":382,"icon":383},"GitHub Actions","i-simple-icons-githubactions",{"layout":379},{"title":382,"icon":383},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions",{"title":5,"description":376},{"loc":386},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions.md","docs\u002F5.x\u002Fintegrations\u002Fgithub-actions","L03ujSQY2K1eejibSyuYcF623TT2zwZBcwc2fhGyBSc",1795727673805,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]