v2.0.0-next.0

This commit is contained in:
github-actions[bot]
2026-06-23 07:33:38 +00:00
parent dad5baf18b
commit 7766d0736f
13 changed files with 391 additions and 0 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+18
View File
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
import{c as e,d as t,l as n,o as r,s as i,u as a}from"./github-B-FmP-qI.js";import{i as o,n as s,r as c,t as l}from"./run-CVDXZtwd.js";import{r as u}from"./utils-CZUacPOo.js";import{t as d}from"./readChangesetState-Otq6gfkp.js";import f from"node:fs/promises";import"node:path";const p=t=>e(t)||void 0;(async()=>{let m=process.env.GITHUB_TOKEN||e(`github-token`);if(!m){a(`Please add the GITHUB_TOKEN to the changesets action`);return}let h=process.cwd(),g=c(m),_=p(`commitMode`)??`git-cli`,v=p(`prDraft`);if(_!==`git-cli`&&_!==`github-api`){a(`Invalid commit mode: ${_}`);return}if(v!==void 0&&v!==`always`&&v!==`create`){a(`Invalid prDraft: ${v}`);return}let y=new o({octokit:_===`github-api`?g:void 0,cwd:h});i(`setupGitUser`)&&(n(`setting git user`),await y.setupUser()),n(`setting GitHub credentials`),await f.writeFile(`${process.env.HOME}/.netrc`,`machine github.com\nlogin github-actions[bot]\npassword ${m}`);let{changesets:b}=await d(h),x=e(`publish`),S=b.length!==0,C=b.some(e=>e.releases.length>0),w=!!x;switch(t(`published`,`false`),t(`publishedPackages`,`[]`),t(`hasChangesets`,String(S)),!0){case!S&&!w:n(`No changesets present or were removed by merging release PR. Not publishing because no publish script found.`);return;case!S&&w:{if(n(`No changesets found. Attempting to publish any unpublished packages to npm`),process.env.NPM_TOKEN){let e=`${process.env.HOME}/.npmrc`;await u(e)?(n(`Found existing user .npmrc file`),(await f.readFile(e,`utf8`)).split(`
`).find(e=>/^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(e))?n(`Found existing auth token for the npm registry in the user .npmrc file`):(n(`Didn't find existing auth token for the npm registry in the user .npmrc file, creating one`),await f.appendFile(e,`\n//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`))):(n(`No user .npmrc file found, creating one with NPM_TOKEN used as auth token`),await f.writeFile(e,`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`))}else process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN&&process.env.ACTIONS_ID_TOKEN_REQUEST_URL?n(`No NPM_TOKEN found, but OIDC is available - using npm trusted publishing`):n(`No NPM_TOKEN or OIDC available - assuming npm is already authenticated`);let e=await l({script:x,githubToken:m,git:y,octokit:g,createGithubReleases:i(`createGithubReleases`),cwd:h});e.published&&(t(`published`,`true`),t(`publishedPackages`,JSON.stringify(e.publishedPackages))),e.exitCode!==0&&(r(`Publish command exited with code ${e.exitCode}${e.published?`, but some packages were published: ${e.publishedPackages.map(e=>`${e.name}@${e.version}`).join(`, `)}`:``}`),process.exit(e.exitCode));return}case S&&!C:n(`All changesets are empty; not creating PR`);return;case S:{let e=c(m),{pullRequestNumber:n}=await s({script:p(`version`),githubToken:m,git:y,octokit:e,cwd:h,prTitle:p(`title`),commitMessage:p(`commit`),hasPublishScript:w,prDraft:v,branch:p(`branch`)});t(`pullRequestNumber`,String(n));return}}})().catch(e=>{r(e),a(e.message)});export{};
+1
View File
@@ -0,0 +1 @@
import{c as e,d as t,u as n}from"./github-B-FmP-qI.js";import{n as r,t as i,u as a}from"./utils-CZUacPOo.js";import o from"node:fs/promises";import s from"node:path";import c from"node:os";try{await l()}catch(e){n(e.message)}async function l(){let n=e(`publish-plan-artifact-id`),r=process.cwd(),i=process.env.RUNNER_TEMP??await o.realpath(c.tmpdir()),l=s.join(i,`changeset-pack-${Date.now()}`);await u(r,{outDir:l,publishPlanPath:n?await d(i,Number(n)):void 0});let p=await a.uploadArtifact(`changeset-pack-${Date.now()}`,await f(l),l,{retentionDays:30});if(p.id===void 0)throw Error(`Packed artifact upload did not return an artifact id`);t(`pack-dir-artifact-id`,String(p.id))}async function u(e,t){let n=[`pack`,`--out-dir`,t.outDir];t.publishPlanPath&&n.push(`--from-plan`,t.publishPlanPath),await r(n,{cwd:e,env:process.env})}async function d(e,t){let n=await i(e,t,`changeset-publish-plan`);return s.join(n,`publish-plan.json`)}async function f(e){let t=await o.readdir(e,{withFileTypes:!0});return(await Promise.all(t.map(async t=>{let n=s.join(e,t.name);return t.isDirectory()?f(n):[n]}))).flat()}export{};
+1
View File
@@ -0,0 +1 @@
import{c as e,d as t,l as n,n as r,t as i,u as a}from"./github-B-FmP-qI.js";try{await o()}catch(e){a(e.message)}async function o(){let a=i.payload.pull_request;if(!a)throw Error("This action should only be run on `pull_request_target` or `pull_request` events");let o=e(`github-token`,{required:!0}),c=e(`body`,{required:!0}),l=e(`update-id`),u=l?s(l):null,d=u?`${u}\n\n${c}`:c,f={repo:a.base.repo.name,owner:a.base.repo.owner.login,issue_number:a.number,body:d},p=r(o),m;u&&(n(`Checking for existing comment...`),m=await p.rest.issues.listComments({repo:a.base.repo.name,owner:a.base.repo.owner.login,issue_number:a.number}).then(e=>e.data.find(e=>e.body?.includes(u))?.id)),m?(n(`Updating existing comment (id: ${m})...`),await p.rest.issues.updateComment({...f,comment_id:m}),t(`comment-id`,m)):(n(`Creating new comment...`),t(`comment-id`,(await p.rest.issues.createComment(f)).data.id)),n(`Done!`)}function s(e){let t=`changesets-action-pr-comment`;return t===e?`<!-- ${t} -->`:`<!-- ${t}:${e} -->`}export{};
+39
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{c as e,d as t,s as n,u as r}from"./github-B-FmP-qI.js";import{i,r as a,t as o}from"./run-CVDXZtwd.js";import{t as s}from"./utils-CZUacPOo.js";import c from"node:fs/promises";import l from"node:os";try{await u()}catch(e){r(e.message)}async function u(){let r=e(`github-token`,{required:!0}),u=e(`script`),d=e(`pack-dir-artifact-id`),f=n(`create-github-releases`),p=process.cwd(),m=a(r),h=await o({script:u,githubToken:r,git:new i({octokit:m,cwd:p}),octokit:m,createGithubReleases:f,cwd:p,fromPackDir:d?await s(process.env.RUNNER_TEMP??await c.realpath(l.tmpdir()),Number(d),`changeset-pack`):void 0});if(h.published?(t(`published`,`true`),t(`published-packages`,JSON.stringify(h.publishedPackages))):t(`published`,`false`),h.exitCode!==0)throw Error(`Publish command exited with code ${h.exitCode}${h.published?`, but some packages were published: ${h.publishedPackages.map(e=>`${e.name}@${e.version}`).join(`, `)}`:``}`)}export{};
+1
View File
@@ -0,0 +1 @@
import{o as e,t}from"./changesets-read.esm-Cr0YoPBA.js";async function n(n=process.cwd()){let r=await e(n),i=await t(n);if(r!==void 0&&r.mode===`pre`){let e=new Set(r.changesets);return{preState:r,changesets:i.filter(t=>!e.has(t.id))}}return{preState:void 0,changesets:i}}export{n as t};
+149
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{d as e,u as t}from"./github-B-FmP-qI.js";import{n,u as r}from"./utils-CZUacPOo.js";import{t as i}from"./readChangesetState-Otq6gfkp.js";import a from"node:fs/promises";import o from"node:path";import s from"node:os";try{await c()}catch(e){t(e.message)}async function c(){let t=await l();if(e(`mode`,t.mode),t.mode===`publish`){let n=await r.uploadArtifact(o.basename(t.publishPlanPath,`.json`),[t.publishPlanPath],o.dirname(t.publishPlanPath),{skipArchive:!0,retentionDays:30});if(n.id===void 0)throw Error(`Publish plan artifact upload did not return an artifact id`);e(`publish-plan-artifact-id`,String(n.id))}}async function l(){let{changesets:e}=await i();if(e.length>0)return e.some(e=>e.releases.length>0)?{mode:`version`}:{mode:`none`};let t=process.cwd(),r=o.join(process.env.RUNNER_TEMP??await a.realpath(s.tmpdir()),`changeset-publish-plan-${Date.now()}.json`);return await n([`publish-plan`,`--output`,r],{cwd:t,env:process.env}),(await u(r)).length===0?{mode:`none`}:{mode:`publish`,publishPlanPath:r}}async function u(e){let t;try{t=await a.readFile(e,`utf8`)}catch(t){throw Error(`Failed to read publish plan at ${e}`,{cause:t})}let n;try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse publish plan at ${e}`,{cause:t})}if(typeof n!=`object`||!n||!(`version`in n)||typeof n.version!=`number`||!(`plan`in n)||!Array.isArray(n.plan))throw Error(`Invalid publish plan at ${e}: expected { version: number; plan: unknown[] }`);return n.plan}export{};
+80
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
import{c as e,d as t,l as n,s as r,u as i}from"./github-B-FmP-qI.js";import{i as a,n as o,r as s}from"./run-CVDXZtwd.js";try{await c()}catch(e){i(e.message)}async function c(){let i=e(`github-token`,{required:!0}),c=e(`script`),l=e(`commit-message`,{required:!0}),u=e(`pr-title`,{required:!0}),d=e(`pr-draft`)||void 0,f=e(`pr-base-branch`),p=e(`commit-mode`)||`git-cli`,m=r(`setup-git-user`);if(d!==void 0&&d!==`always`&&d!==`create`)throw Error(`Invalid pr-draft input: ${d}`);let h=process.cwd(),g=s(i),_=new a({octokit:p===`github-api`?g:void 0,cwd:h});m&&(n(`setting git user`),await _.setupUser());let{pullRequestNumber:v}=await o({script:c,githubToken:i,git:_,octokit:g,cwd:h,prTitle:u,commitMessage:l,hasPublishScript:!0,prDraft:d,branch:f});t(`pr-number`,String(v))}export{};