mirror of
https://github.com/softprops/action-gh-release
synced 2026-10-03 10:11:31 +00:00
Fix missing update release body (#365)
* Update json5 deps * Remove quote around env var `GITHUB_TOKEN` * Factorize search by draft & tag * Correct `_release` undefined when creating a new release * Cleanup package-lock
This commit is contained in:
1 parent
08d85b1534
commit
fb2d03176f
4 files changed
+112
-71
No files matched your search
+1
-1
@@ -50,7 +50,7 @@ inputs:
|
||||
description: "Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Can be `true`, `false`, or `legacy`. Uses GitHub api default if not provided"
|
||||
required: false
|
||||
env:
|
||||
"GITHUB_TOKEN": "As provided by Github Actions"
|
||||
GITHUB_TOKEN: "As provided by Github Actions"
|
||||
outputs:
|
||||
url:
|
||||
description: "URL to the Release HTML Page"
|
||||
|
||||
Vendored
+1
-1
@@ -6,4 +6,4 @@
|
||||
* Released under the MIT License.
|
||||
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,A;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;A=t.prototype;if(isObject(A)===false)return false;if(A.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},6038:e=>{"use strict";function Mime(){this._types=Object.create(null);this._extensions=Object.create(null);for(let e=0;e<arguments.length;e++){this.define(arguments[e])}this.define=this.define.bind(this);this.getType=this.getType.bind(this);this.getExtension=this.getExtension.bind(this)}Mime.prototype.define=function(e,t){for(let A in e){let s=e[A].map((function(e){return e.toLowerCase()}));A=A.toLowerCase();for(let e=0;e<s.length;e++){const i=s[e];if(i[0]==="*"){continue}if(!t&&i in this._types){throw new Error('Attempt to change mapping for "'+i+'" extension from "'+this._types[i]+'" to "'+A+'". Pass `force=true` to allow this, otherwise remove "'+i+'" from the list of extensions for "'+A+'".')}this._types[i]=A}if(t||!this._extensions[A]){const e=s[0];this._extensions[A]=e[0]!=="*"?e:e.substr(1)}}};Mime.prototype.getType=function(e){e=String(e);let t=e.replace(/^.*[/\\]/,"").toLowerCase();let A=t.replace(/^.*\./,"").toLowerCase();let s=t.length<e.length;let i=A.length<t.length-1;return(i||!s)&&this._types[A]||null};Mime.prototype.getExtension=function(e){e=/^\s*([^;\s]*)/.test(e)&&RegExp.$1;return e&&this._extensions[e.toLowerCase()]||null};e.exports=Mime},9994:(e,t,A)=>{"use strict";let s=A(6038);e.exports=new s(A(3114),A(8809))},8809:e=>{e.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecLine truncated
|
||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const s=[];const i=new Uint8Array([13,10]);l=0;let r=false;for(const[t,a]of e){if(typeof a==="string"){const e=S.encode(A+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(a)}\r\n`);s.push(e);l+=e.byteLength}else{const e=S.encode(`${A}; name="${escape(normalizeLinefeeds(t))}"`+(a.name?`; filename="${escape(a.name)}"`:"")+"\r\n"+`Content-Type: ${a.type||"application/octet-stream"}\r\n\r\n`);s.push(e,a,i);if(typeof a.size==="number"){l+=e.byteLength+a.size+i.byteLength}else{r=true}}}const a=S.encode(`--${t}--`);s.push(a);l+=a.byteLength;if(r){l=null}d=e;p=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};c="multipart/form-data; boundary="+t}else if(a(e)){d=e;l=e.size;if(e.type){c=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(i.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}s=e instanceof R?e:r(e)}if(typeof d==="string"||i.isBuffer(d)){l=Buffer.byteLength(d)}if(p!=null){let t;s=new R({async start(){t=p(e)[Symbol.asyncIterator]()},async pull(e){const{value:A,done:i}=await t.next();if(i){queueMicrotask((()=>{e.close()}))}else{if(!I(s)){e.enqueue(new Uint8Array(A))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const u={stream:s,source:d,length:l};return[u,c]}function safelyExtractBody(e,t=false){if(!R){R=A(5356).ReadableStream}if(e instanceof R){B(!i.isDisturbed(e),"The body has already been consumed.");B(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,A]=e.stream.tee();const s=g(A,{transfer:[A]});const[,i]=s.tee();e.stream=t;return{stream:i,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(w(e)){yield e}else{const t=e.stream;if(i.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new h("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=D(t)}return new E([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){u.brandCheck(this,e);throwIfAborted(this[c]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,A]of this.headers)e[t.toLowerCase()]=A;const t=new l;let A;try{A=new s({headers:e,preservePath:true})}catch(e){throw new h(`${e}`,"AbortError")}A.on("field",((e,A)=>{t.append(e,A)}));A.on("file",((e,A,s,i,r)=>{const a=[];if(i==="base64"||i.toLowerCase()==="base64"){let i="";A.on("data",(e=>{i+=e.toString().replace(/[\r\n]/gm,"");const t=i.length-i.length%4;a.push(Buffer.from(i.slice(0,t),"base64"));i=i.slice(t)}));A.on("end",(()=>{a.push(Buffer.from(i,"base64"));t.append(e,new k(a,s,{type:r}))}))}else{A.on("data",(e=>{a.push(e)}));A.on("end",(()=>{t.append(e,new k(a,s,{type:r}))}))}}));const i=new Promise(((e,t)=>{A.on("finish",e);A.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[c].body))A.write(e);A.end();await i;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const A=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[c].body)){if(!w(e)){throw new TypeError("Expected Uint8Array chunk")}t+=A.decode(e,{stream:true})}t+=A.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new l;for(const[A,s]of e){t.append(A,s)}return t}else{await Promise.resolve();throwIfAborted(this[c]);throw u.errors.exception({header:`${e.name}.formData`,message:"Could not parse content as FormData."})}}};return t}function mixinBody(e){Object.assign(e.prototype,bodyMixinMethods(e))}async function specConsumeBody(e,t,A){u.brandCheck(e,A);throwIfAborted(e[c]);if(bodyUnusable(e[c].body)){throw new TypeError("Body is unusable")}const s=p();const errorSteps=e=>s.reject(e);const successSteps=e=>{try{s.resolve(t(e))}catch(e){errorSteps(e)}};if(e[c].body==null){successSteps(new Uint8Array);return s.promise}await d(e[c].body,successSteps,errorSteps);return s.promise}function bodyUnusable(e){return e!=null&&(e.stream.locked||i.isDisturbed(e.stream))}function utf8DecodeBytes(e){if(e.length===0){return""}if(e[0]===239&&e[1]===187&&e[2]===191){e=e.subarray(3)}const t=F.decode(e);return t}function parseJSONFromBytes(e){return JSON.parse(utf8DecodeBytes(e))}function bodyMimeType(e){const{headersList:t}=e[c];const A=t.get("content-Line truncated
|
||||
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */r[i-4]=this.maskKey[0];r[i-3]=this.maskKey[1];r[i-2]=this.maskKey[2];r[i-1]=this.maskKey[3];r[1]=A;if(A===126){r.writeUInt16BE(t,2)}else if(A===127){r[2]=r[3]=0;r.writeUIntBE(t,4,6)}r[1]|=128;for(let e=0;e<t;e++){r[i+e]=this.frameData[e]^this.maskKey[e%4]}return r}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,A)=>{"use strict";const{Writable:s}=A(2781);const i=A(7643);const{parserStates:r,opcodes:a,states:o,emptyBuffer:n}=A(9188);const{kReadyState:p,kSentClose:d,kResponse:l,kReceivedClose:c}=A(7578);const{isValidStatusCode:u,failWebsocketConnection:h,websocketMessageReceived:g}=A(5515);const{WebsocketFrameSend:E}=A(5444);const C={};C.ping=i.channel("undici:websocket:ping");C.pong=i.channel("undici:websocket:pong");class ByteParser extends s{#a=[];#o=0;#n=r.INFO;#p={};#d=[];constructor(e){super();this.ws=e}_write(e,t,A){this.#a.push(e);this.#o+=e.length;this.run(A)}run(e){while(true){if(this.#n===r.INFO){if(this.#o<2){return e()}const t=this.consume(2);this.#p.fin=(t[0]&128)!==0;this.#p.opcode=t[0]&15;this.#p.originalOpcode??=this.#p.opcode;this.#p.fragmented=!this.#p.fin&&this.#p.opcode!==a.CONTINUATION;if(this.#p.fragmented&&this.#p.opcode!==a.BINARY&&this.#p.opcode!==a.TEXT){h(this.ws,"Invalid frame type was fragmented.");return}const A=t[1]&127;if(A<=125){this.#p.payloadLength=A;this.#n=r.READ_DATA}else if(A===126){this.#n=r.PAYLOADLENGTH_16}else if(A===127){this.#n=r.PAYLOADLENGTH_64}if(this.#p.fragmented&&A>125){h(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#p.opcode===a.PING||this.#p.opcode===a.PONG||this.#p.opcode===a.CLOSE)&&A>125){h(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#p.opcode===a.CLOSE){if(A===1){h(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(A);this.#p.closeInfo=this.parseCloseBody(false,e);if(!this.ws[d]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#p.closeInfo.code,0);const t=new E(e);this.ws[l].socket.write(t.createFrame(a.CLOSE),(e=>{if(!e){this.ws[d]=true}}))}this.ws[p]=o.CLOSING;this.ws[c]=true;this.end();return}else if(this.#p.opcode===a.PING){const t=this.consume(A);if(!this.ws[c]){const e=new E(t);this.ws[l].socket.write(e.createFrame(a.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#n=r.INFO;if(this.#o>0){continue}else{e();return}}else if(this.#p.opcode===a.PONG){const t=this.consume(A);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#o>0){continue}else{e();return}}}else if(this.#n===r.PAYLOADLENGTH_16){if(this.#o<2){return e()}const t=this.consume(2);this.#p.payloadLength=t.readUInt16BE(0);this.#n=r.READ_DATA}else if(this.#n===r.PAYLOADLENGTH_64){if(this.#o<8){return e()}const t=this.consume(8);const A=t.readUInt32BE(0);if(A>2**31-1){h(this.ws,"Received payload length > 2^31 bytes.");return}const s=t.readUInt32BE(4);this.#p.payloadLength=(A<<8)+s;this.#n=r.READ_DATA}else if(this.#n===r.READ_DATA){if(this.#o<this.#p.payloadLength){return e()}else if(this.#o>=this.#p.payloadLength){const e=this.consume(this.#p.payloadLength);this.#d.push(e);if(!this.#p.fragmented||this.#p.fin&&this.#p.opcode===a.CONTINUATION){const e=Buffer.concat(this.#d);g(this.ws,this.#p.originalOpcode,e);this.#p={};this.#d.length=0}this.#n=r.INFO}}if(this.#o>0){continue}else{e();break}}}consume(e){if(e>this.#o){return null}else if(e===0){return n}if(this.#a[0].length===e){this.#o-=this.#a[0].length;return this.#a.shift()}const t=Buffer.allocUnsafe(e);let A=0;while(A!==e){const s=this.#a[0];const{length:i}=s;if(i+A===e){t.set(this.#a.shift(),A);break}else if(i+A>e){t.set(s.subarray(0,e-A),A);this.#a[0]=s.subarray(e-A);break}else{t.set(this.#a.shift(),A);A+=s.length}}this.#o-=e;return t}parseCloseBody(e,t){let A;if(t.length>=2){A=t.readUInt16BE(0)}if(e){if(!u(A)){return null}return{code:A}}let s=t.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(A!==undefined&&!u(A)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:A,reason:s}}get closingInfo(){return this.#p.closeInfo}}e.exports={ByteParser:ByteParser}},7578:e=>{"use strict";e.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},5515:(e,t,A)=>{"use strict";const{kReadyState:s,kController:i,kResponse:r,kBinaryType:a,kWebSocketURL:o}=A(7578);const{states:n,opcodes:p}=A(9188);const{MessageEvent:d,ErrorEvent:l}=A(2611);function isEstablished(e){return e[s]===n.OPEN}function isClosing(e){return e[s]===n.CLOSING}function isClosed(e){return e[s]===n.CLOSED}function fireEvent(e,t,A=Event,s){const i=new A(e,s);t.dispatchEvent(i)}function websocketMessageReceived(e,t,A){if(e[s]!==n.OPEN){return}let i;if(t===p.TEXT){try{i=new TextDecoder("utf-8",{fatal:true}).decode(A)Line truncated
|
||||
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */r[i-4]=this.maskKey[0];r[i-3]=this.maskKey[1];r[i-2]=this.maskKey[2];r[i-1]=this.maskKey[3];r[1]=A;if(A===126){r.writeUInt16BE(t,2)}else if(A===127){r[2]=r[3]=0;r.writeUIntBE(t,4,6)}r[1]|=128;for(let e=0;e<t;e++){r[i+e]=this.frameData[e]^this.maskKey[e%4]}return r}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,A)=>{"use strict";const{Writable:s}=A(2781);const i=A(7643);const{parserStates:r,opcodes:a,states:o,emptyBuffer:n}=A(9188);const{kReadyState:p,kSentClose:d,kResponse:l,kReceivedClose:c}=A(7578);const{isValidStatusCode:u,failWebsocketConnection:h,websocketMessageReceived:g}=A(5515);const{WebsocketFrameSend:E}=A(5444);const C={};C.ping=i.channel("undici:websocket:ping");C.pong=i.channel("undici:websocket:pong");class ByteParser extends s{#a=[];#o=0;#n=r.INFO;#p={};#d=[];constructor(e){super();this.ws=e}_write(e,t,A){this.#a.push(e);this.#o+=e.length;this.run(A)}run(e){while(true){if(this.#n===r.INFO){if(this.#o<2){return e()}const t=this.consume(2);this.#p.fin=(t[0]&128)!==0;this.#p.opcode=t[0]&15;this.#p.originalOpcode??=this.#p.opcode;this.#p.fragmented=!this.#p.fin&&this.#p.opcode!==a.CONTINUATION;if(this.#p.fragmented&&this.#p.opcode!==a.BINARY&&this.#p.opcode!==a.TEXT){h(this.ws,"Invalid frame type was fragmented.");return}const A=t[1]&127;if(A<=125){this.#p.payloadLength=A;this.#n=r.READ_DATA}else if(A===126){this.#n=r.PAYLOADLENGTH_16}else if(A===127){this.#n=r.PAYLOADLENGTH_64}if(this.#p.fragmented&&A>125){h(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#p.opcode===a.PING||this.#p.opcode===a.PONG||this.#p.opcode===a.CLOSE)&&A>125){h(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#p.opcode===a.CLOSE){if(A===1){h(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(A);this.#p.closeInfo=this.parseCloseBody(false,e);if(!this.ws[d]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#p.closeInfo.code,0);const t=new E(e);this.ws[l].socket.write(t.createFrame(a.CLOSE),(e=>{if(!e){this.ws[d]=true}}))}this.ws[p]=o.CLOSING;this.ws[c]=true;this.end();return}else if(this.#p.opcode===a.PING){const t=this.consume(A);if(!this.ws[c]){const e=new E(t);this.ws[l].socket.write(e.createFrame(a.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#n=r.INFO;if(this.#o>0){continue}else{e();return}}else if(this.#p.opcode===a.PONG){const t=this.consume(A);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#o>0){continue}else{e();return}}}else if(this.#n===r.PAYLOADLENGTH_16){if(this.#o<2){return e()}const t=this.consume(2);this.#p.payloadLength=t.readUInt16BE(0);this.#n=r.READ_DATA}else if(this.#n===r.PAYLOADLENGTH_64){if(this.#o<8){return e()}const t=this.consume(8);const A=t.readUInt32BE(0);if(A>2**31-1){h(this.ws,"Received payload length > 2^31 bytes.");return}const s=t.readUInt32BE(4);this.#p.payloadLength=(A<<8)+s;this.#n=r.READ_DATA}else if(this.#n===r.READ_DATA){if(this.#o<this.#p.payloadLength){return e()}else if(this.#o>=this.#p.payloadLength){const e=this.consume(this.#p.payloadLength);this.#d.push(e);if(!this.#p.fragmented||this.#p.fin&&this.#p.opcode===a.CONTINUATION){const e=Buffer.concat(this.#d);g(this.ws,this.#p.originalOpcode,e);this.#p={};this.#d.length=0}this.#n=r.INFO}}if(this.#o>0){continue}else{e();break}}}consume(e){if(e>this.#o){return null}else if(e===0){return n}if(this.#a[0].length===e){this.#o-=this.#a[0].length;return this.#a.shift()}const t=Buffer.allocUnsafe(e);let A=0;while(A!==e){const s=this.#a[0];const{length:i}=s;if(i+A===e){t.set(this.#a.shift(),A);break}else if(i+A>e){t.set(s.subarray(0,e-A),A);this.#a[0]=s.subarray(e-A);break}else{t.set(this.#a.shift(),A);A+=s.length}}this.#o-=e;return t}parseCloseBody(e,t){let A;if(t.length>=2){A=t.readUInt16BE(0)}if(e){if(!u(A)){return null}return{code:A}}let s=t.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(A!==undefined&&!u(A)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:A,reason:s}}get closingInfo(){return this.#p.closeInfo}}e.exports={ByteParser:ByteParser}},7578:e=>{"use strict";e.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},5515:(e,t,A)=>{"use strict";const{kReadyState:s,kController:i,kResponse:r,kBinaryType:a,kWebSocketURL:o}=A(7578);const{states:n,opcodes:p}=A(9188);const{MessageEvent:d,ErrorEvent:l}=A(2611);function isEstablished(e){return e[s]===n.OPEN}function isClosing(e){return e[s]===n.CLOSING}function isClosed(e){return e[s]===n.CLOSED}function fireEvent(e,t,A=Event,s){const i=new A(e,s);t.dispatchEvent(i)}function websocketMessageReceived(e,t,A){if(e[s]!==n.OPEN){return}let i;if(t===p.TEXT){try{i=new TextDecoder("utf-8",{fatal:true}).decode(A)Line truncated
|
||||
@@ -6,6 +6,7 @@
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "ncc build src/main.ts --minify",
|
||||
"build-debug": "ncc build src/main.ts --v8-cache --source-map",
|
||||
"test": "jest",
|
||||
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||
|
||||
+109
-69
@@ -208,45 +208,63 @@ export const release = async (
|
||||
try {
|
||||
// you can't get a an existing draft by tag
|
||||
// so we must find one in the list of all releases
|
||||
let _release: Release | undefined = undefined;
|
||||
if (config.input_draft) {
|
||||
for await (const response of releaser.allReleases({
|
||||
owner,
|
||||
repo,
|
||||
})) {
|
||||
let release = response.data.find((release) => release.tag_name === tag);
|
||||
if (release) {
|
||||
return release;
|
||||
}
|
||||
_release = response.data.find((release) => release.tag_name === tag);
|
||||
}
|
||||
} else {
|
||||
_release = (
|
||||
await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag,
|
||||
})
|
||||
).data;
|
||||
}
|
||||
if (_release === null || _release === undefined) {
|
||||
return await createRelease(
|
||||
tag,
|
||||
config,
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
discussion_category_name,
|
||||
generate_release_notes,
|
||||
maxRetries
|
||||
);
|
||||
}
|
||||
let existingRelease = await releaser.getReleaseByTag({
|
||||
owner,
|
||||
repo,
|
||||
tag,
|
||||
});
|
||||
|
||||
const release_id = existingRelease.data.id;
|
||||
let existingRelease: Release = _release!;
|
||||
console.log(
|
||||
`Found release ${existingRelease.name} (with id=${existingRelease.id})`
|
||||
);
|
||||
|
||||
const release_id = existingRelease.id;
|
||||
let target_commitish: string;
|
||||
if (
|
||||
config.input_target_commitish &&
|
||||
config.input_target_commitish !== existingRelease.data.target_commitish
|
||||
config.input_target_commitish !== existingRelease.target_commitish
|
||||
) {
|
||||
console.log(
|
||||
`Updating commit from "${existingRelease.data.target_commitish}" to "${config.input_target_commitish}"`
|
||||
`Updating commit from "${existingRelease.target_commitish}" to "${config.input_target_commitish}"`
|
||||
);
|
||||
target_commitish = config.input_target_commitish;
|
||||
} else {
|
||||
target_commitish = existingRelease.data.target_commitish;
|
||||
target_commitish = existingRelease.target_commitish;
|
||||
}
|
||||
|
||||
const tag_name = tag;
|
||||
const name = config.input_name || existingRelease.data.name || tag;
|
||||
const name = config.input_name || existingRelease.name || tag;
|
||||
// revisit: support a new body-concat-strategy input for accumulating
|
||||
// body parts as a release gets updated. some users will likely want this while
|
||||
// others won't previously this was duplicating content for most which
|
||||
// no one wants
|
||||
const workflowBody = releaseBody(config) || "";
|
||||
const existingReleaseBody = existingRelease.data.body || "";
|
||||
const existingReleaseBody = existingRelease.body || "";
|
||||
let body: string;
|
||||
if (config.input_append_body && workflowBody && existingReleaseBody) {
|
||||
body = existingReleaseBody + "\n" + workflowBody;
|
||||
@@ -257,11 +275,11 @@ export const release = async (
|
||||
const draft =
|
||||
config.input_draft !== undefined
|
||||
? config.input_draft
|
||||
: existingRelease.data.draft;
|
||||
: existingRelease.draft;
|
||||
const prerelease =
|
||||
config.input_prerelease !== undefined
|
||||
? config.input_prerelease
|
||||
: existingRelease.data.prerelease;
|
||||
: existingRelease.prerelease;
|
||||
|
||||
const make_latest = config.input_make_latest;
|
||||
|
||||
@@ -288,58 +306,80 @@ export const release = async (
|
||||
throw error;
|
||||
}
|
||||
|
||||
const tag_name = tag;
|
||||
const name = config.input_name || tag;
|
||||
const body = releaseBody(config);
|
||||
const draft = config.input_draft;
|
||||
const prerelease = config.input_prerelease;
|
||||
const target_commitish = config.input_target_commitish;
|
||||
const make_latest = config.input_make_latest;
|
||||
let commitMessage: string = "";
|
||||
if (target_commitish) {
|
||||
commitMessage = ` using commit "${target_commitish}"`;
|
||||
}
|
||||
console.log(
|
||||
`👩🏭 Creating new GitHub release for tag ${tag_name}${commitMessage}...`
|
||||
return await createRelease(
|
||||
tag,
|
||||
config,
|
||||
releaser,
|
||||
owner,
|
||||
repo,
|
||||
discussion_category_name,
|
||||
generate_release_notes,
|
||||
maxRetries
|
||||
);
|
||||
try {
|
||||
let release = await releaser.createRelease({
|
||||
owner,
|
||||
repo,
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish,
|
||||
discussion_category_name,
|
||||
generate_release_notes,
|
||||
make_latest,
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
// presume a race with competing matrix runs
|
||||
console.log(`⚠️ GitHub release failed with status: ${error.status}`);
|
||||
console.log(`${JSON.stringify(error.response.data)}`);
|
||||
|
||||
switch (error.status) {
|
||||
case 403:
|
||||
console.log(
|
||||
"Skip retry — your GitHub token/PAT does not have the required permission to create a release"
|
||||
);
|
||||
throw error;
|
||||
|
||||
case 404:
|
||||
console.log("Skip retry - discussion category mismatch");
|
||||
throw error;
|
||||
|
||||
case 422:
|
||||
console.log("Skip retry - validation failed");
|
||||
throw error;
|
||||
}
|
||||
|
||||
console.log(`retrying... (${maxRetries - 1} retries remaining)`);
|
||||
return release(config, releaser, maxRetries - 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async function createRelease(
|
||||
tag: string,
|
||||
config: Config,
|
||||
releaser: Releaser,
|
||||
owner: string,
|
||||
repo: string,
|
||||
discussion_category_name: string | undefined,
|
||||
generate_release_notes: boolean | undefined,
|
||||
maxRetries: number
|
||||
) {
|
||||
const tag_name = tag;
|
||||
const name = config.input_name || tag;
|
||||
const body = releaseBody(config);
|
||||
const draft = config.input_draft;
|
||||
const prerelease = config.input_prerelease;
|
||||
const target_commitish = config.input_target_commitish;
|
||||
const make_latest = config.input_make_latest;
|
||||
let commitMessage: string = "";
|
||||
if (target_commitish) {
|
||||
commitMessage = ` using commit "${target_commitish}"`;
|
||||
}
|
||||
console.log(
|
||||
`👩🏭 Creating new GitHub release for tag ${tag_name}${commitMessage}...`
|
||||
);
|
||||
try {
|
||||
let release = await releaser.createRelease({
|
||||
owner,
|
||||
repo,
|
||||
tag_name,
|
||||
name,
|
||||
body,
|
||||
draft,
|
||||
prerelease,
|
||||
target_commitish,
|
||||
discussion_category_name,
|
||||
generate_release_notes,
|
||||
make_latest,
|
||||
});
|
||||
return release.data;
|
||||
} catch (error) {
|
||||
// presume a race with competing matrix runs
|
||||
console.log(`⚠️ GitHub release failed with status: ${error.status}`);
|
||||
console.log(`${JSON.stringify(error.response.data)}`);
|
||||
|
||||
switch (error.status) {
|
||||
case 403:
|
||||
console.log(
|
||||
"Skip retry — your GitHub token/PAT does not have the required permission to create a release"
|
||||
);
|
||||
throw error;
|
||||
|
||||
case 404:
|
||||
console.log("Skip retry - discussion category mismatch");
|
||||
throw error;
|
||||
|
||||
case 422:
|
||||
console.log("Skip retry - validation failed");
|
||||
throw error;
|
||||
}
|
||||
|
||||
console.log(`retrying... (${maxRetries - 1} retries remaining)`);
|
||||
return release(config, releaser, maxRetries - 1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user