release: cut v3.0.0 for Node 24 upgrade (#670)

- feat: move action runtime to node24 and require Node >=24
- chore: bump @types/node, enable Dependabot updates, rebuild dist
- cut 3.0.0 release

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Copilot authored and GitHub committed 2026-04-12 00:45:48 -04:00
1 parent c2e35e05a7
commit b430933298
9 files changed
+54 -32

No files matched your search

-3
View File
@@ -12,9 +12,6 @@ updates:
- dependency-name: node-fetch
versions:
- ">=3.0.0"
- dependency-name: "@types/node"
versions:
- ">=22.0.0"
commit-message:
prefix: "chore(deps)"
- package-ecosystem: github-actions
+15
View File
@@ -1,3 +1,18 @@
## 3.0.0
`3.0.0` is a major release that moves the action runtime from Node 20 to Node 24.
Use `v3` on GitHub-hosted runners and self-hosted fleets that already support the
Node 24 Actions runtime. If you still need the last Node 20-compatible line, stay on
`v2.6.2`.
## What's Changed
### Other Changes 🔄
* Move the action runtime and bundle target to Node 24
* Update `@types/node` to the Node 24 line and allow future Dependabot updates
* Keep the floating major tag on `v3`; `v2` remains pinned to the latest `2.x` release
## 2.6.2
## What's Changed
+10 -7
View File
@@ -39,6 +39,9 @@ Typically usage of this action involves adding a step to a build that
is gated pushes to git tags. You may find `step.if` field helpful in accomplishing this
as it maximizes the reuse value of your workflow for non-tag pushes.
`v3` requires a GitHub Actions runtime that supports Node 24. If you still need the
last Node 20-compatible line, stay on `v2.6.2`.
Below is a simple example of `step.if` tag gating
```yaml
@@ -53,7 +56,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
```
@@ -74,7 +77,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
```
### ⬆️ Uploading release assets
@@ -105,7 +108,7 @@ jobs:
- name: Test
run: cat Release.txt
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
files: Release.txt
@@ -129,7 +132,7 @@ jobs:
- name: Test
run: cat Release.txt
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
files: |
@@ -146,7 +149,7 @@ and keep the `files` patterns relative to that directory.
```yaml
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
working_directory: dist
@@ -175,7 +178,7 @@ jobs:
- name: Generate Changelog
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
@@ -193,7 +196,7 @@ comparison range does not match the release series you want to publish.
```yaml
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
tag_name: stage-2026-03-15
target_commitish: ${{ github.sha }}
+5 -4
View File
@@ -22,13 +22,14 @@ Use this checklist when cutting a new `action-gh-release` release.
- `npm run build`
- `npm test`
5. Commit the release prep.
- Use a plain release commit message like `release 2.5.4`.
- Use a plain release commit message like `release 3.0.0`.
6. Create the annotated tag for the release commit.
- Example: `git tag -a v2.5.4 -m "v2.5.4"`
- Example: `git tag -a v3.0.0 -m "v3.0.0"`
7. Push the commit and tag.
- Example: `git push origin master && git push origin v2.5.4`
- Example: `git push origin master && git push origin v3.0.0`
8. Move the floating major tag to the new release tag.
- For the current major line, either run `npm run updatetag` or update the script first if the major ever changes.
- For the current major line, run `npm run updatetag` to move `v3`.
- Keep `v2` pinned to the latest `2.x` release for consumers that still need the Node 20 runtime.
- Verify the floating tag points at the same commit as the new full tag.
9. Create the GitHub release from the new tag.
- Prefer the release body from [CHANGELOG.md](CHANGELOG.md), then let GitHub append generated notes only if they add value.
+1 -1
View File
@@ -75,7 +75,7 @@ outputs:
assets:
description: "JSON array containing information about each uploaded asset, in the format given [here](https://docs.github.com/en/rest/reference/repos#upload-a-release-asset--code-samples) (minus the `uploader` field)"
runs:
using: "node20"
using: "node24"
main: "dist/index.js"
branding:
color: "green"
+1 -1
View File
@@ -49,7 +49,7 @@ ${o}`;break;case"retry":UB(o)&&(s[i]=o);break;case"id":NB(o)&&(s[i]=o);break;cas
globstar while`,e,l,t,p,g),this.matchOne(e.slice(l),t.slice(p),s))return this.debug("globstar found match!",l,a,g),!0;if(g==="."||g===".."||!r.dot&&g.charAt(0)==="."){this.debug("dot detected!",e,l,t,p);break}this.debug("globstar swallow a segment, and continue"),l++}return!!(s&&(this.debug(`
>>> no match, partial?`,e,l,t,p),l===a))}let h;if(typeof c=="string"?(h=u===c,this.debug("string match",c,u,h)):(h=c.test(u),this.debug("pattern match",c,u,h)),!h)return!1}if(o===a&&n===A)return!0;if(o===a)return s;if(n===A)return o===a-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return HI(this.pattern,this.options)}parse(e){Ja(e);let t=this.options;if(e==="**")return be;if(e==="")return"";let s,r=null;(s=e.match(TL))?r=t.dot?SL:FL:(s=e.match(CL))?r=(t.nocase?t.dot?yL:bL:t.dot?wL:IL)(s[1]):(s=e.match(UL))?r=(t.nocase?t.dot?GL:NL:t.dot?ML:LL)(s):(s=e.match(xL))?r=t.dot?kL:vL:(s=e.match(DL))&&(r=RL);let i=_I.fromGlob(e,this.options).toMMPattern();return r&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,s=t.noglobstar?OL:t.dot?JL:PL,r=new Set(t.nocase?["i"]:[]),i=e.map(a=>{let A=a.map(u=>{if(u instanceof RegExp)for(let l of u.flags.split(""))r.add(l);return typeof u=="string"?jL(u):u===be?be:u._src});A.forEach((u,l)=>{let p=A[l+1],g=A[l-1];u!==be||g===be||(g===void 0?p!==void 0&&p!==be?A[l+1]="(?:\\/|"+s+"\\/)?"+p:A[l]=s:p===void 0?A[l-1]=g+"(?:\\/|\\/"+s+")?":p!==be&&(A[l-1]=g+"(?:\\/|\\/"+s+"\\/)"+p,A[l+1]=be))});let c=A.filter(u=>u!==be);if(this.partial&&c.length>=1){let u=[];for(let l=1;l<=c.length;l++)u.push(c.slice(0,l).join("/"));return"(?:"+u.join("|")+")"}return c.join("/")}).join("|"),[o,n]=e.length>1?["(?:",")"]:["",""];i="^"+o+i+n+"$",this.partial&&(i="^(?:\\/|"+o+i.slice(1,-1)+n+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let s=this.options;this.isWindows&&(e=e.split("\\").join("/"));let r=this.slashSplit(e);this.debug(this.pattern,"split",r);let i=this.set;this.debug(this.pattern,"set",i);let o=r[r.length-1];if(!o)for(let n=r.length-2;!o&&n>=0;n--)o=r[n];for(let n=0;n<i.length;n++){let a=i[n],A=r;if(s.matchBase&&a.length===1&&(A=[o]),this.matchOne(A,a,t))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(e){return ye.defaults(e).Minimatch}};ye.AST=_I;ye.Minimatch=fs;ye.escape=YI;ye.unescape=Xr;var zL=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qI=new Set,tp=typeof process=="object"&&process?process:{},WI=(e,t,s,r)=>{typeof tp.emitWarning=="function"?tp.emitWarning(e,t,s,r):console.error(`[${s}] ${t}: ${e}`)},Pa=globalThis.AbortController,mI=globalThis.AbortSignal;if(typeof Pa>"u"){mI=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},Pa=class{constructor(){t()}signal=new mI;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s)}}};let e=tp.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,WI("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var ZL=e=>!qI.has(e),ms=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),jI=e=>ms(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Ya:null:null,Ya=class extends Array{constructor(e){super(e),this.fill(0)}},KL=class po{heap;length;static#e=!1;static create(t){let s=jI(t);if(!s)return[];po.#e=!0;let r=new po(t,s);return po.#e=!1,r}constructor(t,s){if(!po.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Va=class zI{#e;#t;#i;#s;#r;#A;#a;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#g;#h;#u;#n;#d;#C;#B;#E;#k;#m;#b;#y;#f;#Q;#I;#x;#o;#U;static unsafeExposeInternals(t){return{starts:t.#y,ttls:t.#f,autopurgeTimers:t.#Q,sizes:t.#b,keyMap:t.#h,keyList:t.#u,valList:t.#n,next:t.#d,prev:t.#C,get head(){return t.#B},get tail(){return t.#E},free:t.#k,isBackgroundFetch:s=>t.#p(s),backgroundFetch:(s,r,i,o)=>t.#J(s,r,i,o),moveToTail:s=>t.#G(s),indexes:s=>t.#R(s),rindexes:s=>t.#T(s),isStale:s=>t.#w(s)}}get max(){return this.#e}get maxSize(){return th Line truncated
${i.data.body}`:r.body=i.data.body}return r.body=r.body?this.truncateReleaseNotes(r.body):void 0,r}truncateReleaseNotes(t){return t.substring(0,124999)}async createRelease(t){return this.github.rest.repos.createRelease(await this.prepareReleaseMutation(t))}async updateRelease(t){return this.github.rest.repos.updateRelease(await this.prepareReleaseMutation(t))}async finalizeRelease(t){return await this.github.rest.repos.updateRelease({owner:t.owner,repo:t.repo,release_id:t.release_id,draft:!1,make_latest:t.make_latest,discussion_category_name:t.discussion_category_name})}allReleases(t){let s={per_page:100,...t};return this.github.paginate.iterator(this.github.rest.repos.listReleases.endpoint.merge(s))}async listReleaseAssets(t){return this.github.paginate(this.github.rest.repos.listReleaseAssets,{...t,per_page:100})}async deleteReleaseAsset(t){await this.github.rest.repos.deleteReleaseAsset(t)}async deleteRelease(t){await this.github.rest.repos.deleteRelease(t)}async updateReleaseAsset(t){return await this.github.rest.repos.updateReleaseAsset(t)}async uploadReleaseAsset(t){return this.github.request({method:"POST",url:t.url,headers:{"content-length":`${t.size}`,"content-type":t.mime,authorization:`token ${t.token}`},data:t.data})}},G_=e=>({name:(0,Tw.basename)(e),mime:M_(e),size:(0,kw.statSync)(e).size}),M_=e=>(0,Rw.lookup)(e)||"application/octet-stream",lp=(e,t)=>t.name===e||t.name===xw(e)||t.label===e,L_=e=>{let t=e?.status??e?.response?.status,s=e?.request?.url,r=e?.message,i=typeof s=="string"&&(/\/releases\/assets\//.test(s)||/\/releases\/\d+\/assets(?:\?|$)/.test(s));return t===404&&(i||typeof r=="string"&&r.includes("update-a-release-asset"))},__=e=>{let t=e?.status??e?.response?.status,s=e?.response?.data?.message??e?.message;return t===422&&/immutable release/i.test(String(s))},Y_=(e,t)=>t?`Cannot upload asset ${e} to an immutable release. GitHub only allows asset uploads before a release is published, but draft prereleases publish with the release.published event instead of release.prereleased. If you need prereleases with assets on an immutable-release repository, keep the release as a draft with draft: true, then publish it later from that draft and subscribe downstream workflows to release.published.`:`Cannot upload asset ${e} to an immutable release. GitHub only allows asset uploads before a release is published, so upload assets to a draft release before you publish it.`,Fw=async(e,t,s,r,i)=>{let[o,n]=e.github_repository.split("/"),{name:a,mime:A,size:c}=G_(r),u=s.match(/\/releases\/(\d+)\/assets/),l=u?Number(u[1]):void 0,p=i.find(m=>lp(a,m));if(p){if(e.input_overwrite_files===!1)return console.log(`Asset ${a} already exists and overwrite_files is false...`),null;console.log(`\u267B\uFE0F Deleting previously uploaded asset ${a}...`),await t.deleteReleaseAsset({asset_id:p.id||1,owner:o,repo:n})}console.log(`\u2B06\uFE0F Uploading ${a}...`);let g=new URL(s);g.searchParams.append("name",a);let h=async(m,C=3)=>{if(l!==void 0)for(let B=1;B<=C;B++){let S=(await t.listReleaseAssets({owner:o,repo:n,release_id:l})).find(m);if(S)return S;B<C&&await new Promise(G=>setTimeout(G,1e3))}},E=async()=>{let m=await(0,Dw.open)(r);try{return await t.uploadReleaseAsset({url:g.toString(),size:c,mime:A,token:e.github_token,data:m.readableWebStream({type:"bytes"})})}finally{await m.close()}},f=async m=>{if(!m.name||m.name===a||!m.id)return m;console.log(`\u270F\uFE0F Restoring asset label to ${a}...`);let C=async B=>{let{data:b}=await t.updateReleaseAsset({owner:o,repo:n,asset_id:B,name:m.name,label:a});return b};try{return await C(m.id)}catch(B){if((B?.status??B?.response?.status)===404&&l!==void 0)try{let S=await h(G=>G.id===m.id||G.name===m.name);if(S)return await C(S.id)}catch(S){console.warn(`error refreshing release assets for ${a}: ${S}`)}return console.warn(`error updating release asset label for ${a}: ${B}`),m}},d=async m=>{let C=m.data;if(m.status!==201)throw new Error(`Failed to upload release asset ${a}. received status code ${m.status}
${i.data.body}`:r.body=i.data.body}return r.body=r.body?this.truncateReleaseNotes(r.body):void 0,r}truncateReleaseNotes(t){return t.substring(0,124999)}async createRelease(t){return this.github.rest.repos.createRelease(await this.prepareReleaseMutation(t))}async updateRelease(t){return this.github.rest.repos.updateRelease(await this.prepareReleaseMutation(t))}async finalizeRelease(t){return await this.github.rest.repos.updateRelease({owner:t.owner,repo:t.repo,release_id:t.release_id,draft:!1,make_latest:t.make_latest,discussion_category_name:t.discussion_category_name})}allReleases(t){let s={per_page:100,...t};return this.github.paginate.iterator(this.github.rest.repos.listReleases.endpoint.merge(s))}async listReleaseAssets(t){return this.github.paginate(this.github.rest.repos.listReleaseAssets,{...t,per_page:100})}async deleteReleaseAsset(t){await this.github.rest.repos.deleteReleaseAsset(t)}async deleteRelease(t){await this.github.rest.repos.deleteRelease(t)}async updateReleaseAsset(t){return await this.github.rest.repos.updateReleaseAsset(t)}async uploadReleaseAsset(t){return this.github.request({method:"POST",url:t.url,headers:{"content-length":`${t.size}`,"content-type":t.mime,authorization:`token ${t.token}`},data:t.data})}},G_=e=>({name:(0,Tw.basename)(e),mime:M_(e),size:(0,kw.statSync)(e).size}),M_=e=>(0,Rw.lookup)(e)||"application/octet-stream",lp=(e,t)=>t.name===e||t.name===xw(e)||t.label===e,L_=e=>{let t=e?.status??e?.response?.status,s=e?.request?.url,r=e?.message,i=typeof s=="string"&&(/\/releases\/assets\//.test(s)||/\/releases\/\d+\/assets(?:\?|$)/.test(s));return t===404&&(i||typeof r=="string"&&r.includes("update-a-release-asset"))},__=e=>{let t=e?.status??e?.response?.status,s=e?.response?.data?.message??e?.message;return t===422&&/immutable release/i.test(String(s))},Y_=(e,t)=>t?`Cannot upload asset ${e} to an immutable release. GitHub only allows asset uploads before a release is published, but draft prereleases publish with the release.published event instead of release.prereleased. If you need prereleases with assets on an immutable-release repository, keep the release as a draft with draft: true, then publish it later from that draft and subscribe downstream workflows to release.published.`:`Cannot upload asset ${e} to an immutable release. GitHub only allows asset uploads before a release is published, so upload assets to a draft release before you publish it.`,Fw=async(e,t,s,r,i)=>{let[o,n]=e.github_repository.split("/"),{name:a,mime:A,size:c}=G_(r),u=s.match(/\/releases\/(\d+)\/assets/),l=u?Number(u[1]):void 0,p=i.find(m=>lp(a,m));if(p){if(e.input_overwrite_files===!1)return console.log(`Asset ${a} already exists and overwrite_files is false...`),null;console.log(`\u267B\uFE0F Deleting previously uploaded asset ${a}...`),await t.deleteReleaseAsset({asset_id:p.id||1,owner:o,repo:n})}console.log(`\u2B06\uFE0F Uploading ${a}...`);let g=new URL(s);g.searchParams.append("name",a);let h=async(m,C=3)=>{if(l!==void 0)for(let B=1;B<=C;B++){let S=(await t.listReleaseAssets({owner:o,repo:n,release_id:l})).find(m);if(S)return S;B<C&&await new Promise(G=>setTimeout(G,1e3))}},E=async()=>{let m=await(0,Dw.open)(r);try{return await t.uploadReleaseAsset({url:g.toString(),size:c,mime:A,token:e.github_token,data:m.readableWebStream()})}finally{await m.close()}},f=async m=>{if(!m.name||m.name===a||!m.id)return m;console.log(`\u270F\uFE0F Restoring asset label to ${a}...`);let C=async B=>{let{data:b}=await t.updateReleaseAsset({owner:o,repo:n,asset_id:B,name:m.name,label:a});return b};try{return await C(m.id)}catch(B){if((B?.status??B?.response?.status)===404&&l!==void 0)try{let S=await h(G=>G.id===m.id||G.name===m.name);if(S)return await C(S.id)}catch(S){console.warn(`error refreshing release assets for ${a}: ${S}`)}return console.warn(`error updating release asset label for ${a}: ${B}`),m}},d=async m=>{let C=m.data;if(m.status!==201)throw new Error(`Failed to upload release asset ${a}. received status code ${m.status}
${C.message}
${JSON.stringify(C.errors)}`);let B=await f(C);return console.log(`\u2705 Uploaded ${a}`),B};try{return await d(await E())}catch(m){let C=m?.status??m?.response?.status,B=m?.response?.data;if(__(m))throw new Error(Y_(a,e.input_prerelease));if(l!==void 0&&L_(m))try{let b=await h(S=>lp(a,S));if(b)return console.warn(`error updating release asset metadata for ${a}: ${m}. Matching asset is present after refresh; continuing...`),b}catch(b){console.warn(`error refreshing release assets after metadata update failure: ${b}`)}if(e.input_overwrite_files!==!1&&C===422&&B?.errors?.[0]?.code==="already_exists"&&l!==void 0){console.log(`\u26A0\uFE0F Asset ${a} already exists (race condition), refreshing assets and retrying once...`);let S=(await t.listReleaseAssets({owner:o,repo:n,release_id:l})).find(G=>lp(a,G));if(S)return await t.deleteReleaseAsset({owner:o,repo:n,asset_id:S.id}),await d(await E())}throw m}},up=async(e,t,s=3)=>{if(s<=0)throw console.log("\u274C Too many retries. Aborting..."),new Error("Too many retries.");let[r,i]=e.github_repository.split("/"),o=cp(e.input_tag_name)||(fo(e.github_ref)?e.github_ref.replace("refs/tags/",""):""),n=e.input_discussion_category_name,a=e.input_generate_release_notes,A=e.input_previous_tag;a&&A&&console.log(`\u{1F4DD} Generating release notes using previous tag ${A}`);try{let c=await Sw(t,r,i,o);if(c===void 0)return await vw(o,e,t,r,i,n,a,s,A);let u=c;console.log(`Found release ${u.name} (with id=${u.id})`);let l=u.id,p;e.input_target_commitish&&e.input_target_commitish!==u.target_commitish?(console.log(`Updating commit from "${u.target_commitish}" to "${e.input_target_commitish}"`),p=e.input_target_commitish):p=u.target_commitish;let g=o,h=e.input_name||u.name||o,E=Ap(e)||"",f=u.body||"",d;e.input_append_body&&E&&f?d=f+`
`+E:d=E||f;let m=e.input_prerelease!==void 0?e.input_prerelease:u.prerelease,C=e.input_make_latest;return{release:(await t.updateRelease({owner:r,repo:i,release_id:l,tag_name:g,target_commitish:p,name:h,body:d,draft:u.draft,prerelease:m,discussion_category_name:n,generate_release_notes:a,make_latest:C,previous_tag_name:A})).data,created:!1}}catch(c){if(c.status!==404)throw console.log(`\u26A0\uFE0F Unexpected error fetching GitHub release for tag ${e.github_ref}: ${c}`),c;return await vw(o,e,t,r,i,n,a,s,A)}},pp=async(e,t,s,r=!1,i=3)=>{if(e.input_draft===!0||s.draft===!1)return s;if(i<=0)throw console.log("\u274C Too many retries. Aborting..."),new Error("Too many retries.");let[o,n]=e.github_repository.split("/");try{let{data:a}=await t.finalizeRelease({owner:o,repo:n,release_id:s.id,make_latest:e.input_make_latest,discussion_category_name:e.input_discussion_category_name});return a}catch(a){if(console.warn(`error finalizing release: ${a}`),r&&s.draft&&j_(a)){let A=!1;try{console.log(`\u{1F9F9} Deleting draft release ${s.id} for tag ${s.tag_name} because tag creation is blocked by repository rules...`),await t.deleteRelease({owner:o,repo:n,release_id:s.id}),A=!0}catch(u){console.warn(`error deleting orphan draft release ${s.id}: ${u}`)}let c=A?`Deleted draft release ${s.id} to avoid leaving an orphaned draft release.`:`Failed to delete draft release ${s.id}; manual cleanup may still be required.`;throw new Error(`Tag creation for ${s.tag_name} is blocked by repository rules. ${c}`)}return console.log(`retrying... (${i-1} retries remaining)`),pp(e,t,s,r,i-1)}},gp=async(e,t,s,r=3)=>{if(r<=0)throw console.log("\u274C Too many retries. Aborting..."),new Error("Too many retries.");let[i,o]=e.github_repository.split("/");try{return await t.listReleaseAssets({owner:i,repo:o,release_id:s.id})}catch(n){return console.warn(`error listing assets of release: ${n}`),console.log(`retrying... (${r-1} retries remaining)`),gp(e,t,s,r-1)}};async function Sw(e,t,s,r){try{let{data:i}=await e.getReleaseByTag({owner:t,repo:s,tag:r});return i}catch(i){if(i.status===404)return;throw i}}var O_=1e3,J_=2;async function P_(e){await new Promise(t=>setTimeout(t,e))}async function H_(e,t,s,r){let i=[],o=0;for await(let n of e.allReleases({owner:t,repo:s}))if(i.push(...n.data.filter(a=>a.tag_name===r)),o+=1,o>=J_)break;return i}function V_(e,t){return t&&e.some(s=>s.id===t.id)||e.length===0?t:[...e].sort((s,r)=>s.draft!==r.draft?Number(s.draft)-Number(r.draft):s.id-r.id)[0]}async function q_(e,t,s,r,i,o){let n=Array.from(new Map(o.map(a=>[a.id,a])).values());for(let a of n)if(!(a.id===i||!a.draft||a.assets.length>0))try{console.log(`\u{1F9F9} Removing duplicate draft release ${a.id} for tag ${r}...`),await e.deleteRelease({owner:t,repo:s,release_id:a.id})}catch(A){console.warn(`error deleting duplicate release ${a.id}: ${A}`)}}async function W_(e,t,s,r,i,o){let n=Math.max(o,1);for(let a=1;a<=n;a+=1){let A;try{A=await Sw(e,t,s,r)}catch(l){console.warn(`error reloading release for tag ${r}: ${l}`)}let c=[];try{c=await H_(e,t,s,r)}catch(l){console.warn(`error listing recent releases for tag ${r}: ${l}`)}let u=V_(c,A);if(u)return u.id!==i.id&&console.log(`\u21AA\uFE0F Using release ${u.id} for tag ${r} instead of duplicate draft ${i.id}`),await q_(e,t,s,r,u.id,[i,...c]),u;a<n&&(console.log(`Release ${i.id} is not yet discoverable by tag ${r}, retrying... (${n-a} retries remaining)`),await P_(O_))}return console.log(`\u26A0\uFE0F Continuing with newly created release ${i.id} because tag ${r} is still not discoverable`),i}async function vw(e,t,s,r,i,o,n,a,A){let c=e,u=t.input_name||e,l=Ap(t),p=t.input_prerelease,g=p===!0?t.input_draft===!0:!0,h=t.input_target_commitish,E=t.input_make_latest,f="";h&&(f=` using commit "${h}"`),console.log(`\u{1F469}\u200D\u{1F3ED} Creating new GitHub release for tag ${c}${f}...`);try{let d=await s.createRelease({owner:r,repo:i,tag_name:c,name:u,body:l,draft:g,prerelease:p,target_commitish:h,discussion_category_name:o,generate_release_notes:n,make_latest:E,previous_tag_name:A}),m=await W_(s,r,i,c,d.data,a);return{release:m,created:m.id===d.data.id}}catch(d){switch(console.log(`\u26A0\uFE0F GitHub release failed with status: ${d.status}`),console.log(`${JSON.stringify(d.response.data)}`),d.status){case 403:throw console.log("Skip retry \u2014 your GitHub token/PAT does not have the required permission to create a release"),d;case 404:throw console.log("Skip retry - discussion category mismatch"),d;case 422:if(d.response?.data?.errors?.[0]?.code==="already_exists")console.log("\u26A0\uFE0F Release already exists (race condition detected), retrying to find and update existing release...");else throw console.log("Skip retry - validation failed"),d;break}return console.log(`retrying... (${a-1} retries remaining)`),up(t,s,a-1)}}function j_(e){let t=e?.response?.data?.errors;return!Array.isArray(t)||e?.status!==422?!1:t.some(({field:s,message:r})=>s==="pre_receive"&&typeof r=="string"&&r.includes("creations being restri Line truncated
+13 -10
View File
@@ -1,12 +1,12 @@
{
"name": "action-gh-release",
"version": "2.6.2",
"version": "3.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "action-gh-release",
"version": "2.6.2",
"version": "3.0.0",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.1.0",
@@ -18,7 +18,7 @@
"devDependencies": {
"@types/glob": "^9.0.0",
"@types/mime-types": "^3.0.1",
"@types/node": "^20.19.39",
"@types/node": "^24",
"@vitest/coverage-v8": "^4.1.4",
"esbuild": "^0.28.0",
"prettier": "3.8.2",
@@ -26,6 +26,9 @@
"typescript": "^6.0.2",
"typescript-formatter": "^7.2.2",
"vitest": "^4.0.4"
},
"engines": {
"node": ">=24"
}
},
"node_modules/@actions/core": {
@@ -1209,13 +1212,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.19.39",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.39.tgz",
"integrity": "sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw==",
"version": "24.12.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.2.tgz",
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": "~7.16.0"
}
},
"node_modules/@vitest/coverage-v8": {
@@ -2477,9 +2480,9 @@
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT"
},
+8 -5
View File
@@ -1,17 +1,17 @@
{
"name": "action-gh-release",
"version": "2.6.2",
"version": "3.0.0",
"private": true,
"description": "GitHub Action for creating GitHub Releases",
"main": "lib/main.js",
"scripts": {
"build": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/index.js --minify",
"build-debug": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/index.js --sourcemap --keep-names",
"build": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node24 --outfile=dist/index.js --minify",
"build-debug": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node24 --outfile=dist/index.js --sourcemap --keep-names",
"typecheck": "tsc --noEmit",
"test": "vitest --coverage",
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
"updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2"
"updatetag": "git tag -d v3 >/dev/null 2>&1 || true; git push origin :v3 >/dev/null 2>&1 || true; git tag -a v3 -m '' && git push origin v3"
},
"repository": {
"type": "git",
@@ -21,6 +21,9 @@
"actions"
],
"author": "softprops",
"engines": {
"node": ">=24"
},
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.1.0",
@@ -32,7 +35,7 @@
"devDependencies": {
"@types/glob": "^9.0.0",
"@types/mime-types": "^3.0.1",
"@types/node": "^20.19.39",
"@types/node": "^24",
"@vitest/coverage-v8": "^4.1.4",
"esbuild": "^0.28.0",
"prettier": "3.8.2",
+1 -1
View File
@@ -367,7 +367,7 @@ export const upload = async (
size,
mime,
token: config.github_token,
data: fh.readableWebStream({ type: 'bytes' }),
data: fh.readableWebStream(),
});
} finally {
await fh.close();