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