From 8f24390df009a496891208e5e36b8a1de1f45135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Wed, 3 Apr 2024 14:01:25 +0200 Subject: [PATCH] fix: close immediately (#75) * fix * add test for outputs * ci: use correct outputs from setup bun * dist update * feat: add timeout * c * increase * [autofix.ci] apply automated fixes * refactor: remove unnecesary loging, decrease retries * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 6 +++--- dist/setup/index.js | 2 +- src/index.ts | 2 ++ src/utils.ts | 10 ++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e53c763..a4896e36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,9 +16,6 @@ jobs: continue-on-error: true strategy: matrix: - include: - - os: windows-latest - bun-version: canary os: - ubuntu-latest - macos-latest @@ -40,12 +37,15 @@ jobs: - name: Setup Bun uses: ./ + id: setup_bun with: bun-version: ${{ matrix.bun-version }} - name: Run Bun + id: run_bun run: | bun --version + setup-bun-from-package-json-version: runs-on: ${{ matrix.os }} strategy: diff --git a/dist/setup/index.js b/dist/setup/index.js index 0ed3e3a5..aab74bd2 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -45,7 +45,7 @@ ${o}:${decodeURIComponent(n[o])}`}return i}},Ve=class extends js{constructor(e,a `);let o=e.computeHMACSHA256(s);return new La(a,o,i.toString(),r,n,t.protocol,t.startsOn,t.expiresOn,t.ipRange,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,t.encryptionScope)}var $u=class t extends Us{constructor(e,a,i){let r;Fi(a)?r=a:M.isNode&&a instanceof Ve||a instanceof Te||M.isTokenCredential(a)?r=Oe(a,i):r=Oe(new Te,i),super(e,r),this.serviceContext=new Ad(this.storageClientContext)}static fromConnectionString(e,a){a=a||{};let i=En(e);if(i.kind==="AccountConnString")if(M.isNode){let r=new Ve(i.accountName,i.accountKey);a.proxyOptions||(a.proxyOptions=M.getDefaultProxySettings(i.proxyUri));let n=Oe(r,a);return new t(i.url,n)}else throw new Error("Account connection string is only supported in Node.js environment");else if(i.kind==="SASConnString"){let r=Oe(new Te,a);return new t(i.url+"?"+i.accountSas,r)}else throw new Error("Connection string must be either an Account connection string or a SAS connection string")}getContainerClient(e){return new Fd(ze(this.url,encodeURIComponent(e)),this.pipeline)}async createContainer(e,a={}){let{span:i,updatedOptions:r}=L("BlobServiceClient-createContainer",a);try{let n=this.getContainerClient(e),s=await n.create(r);return{containerClient:n,containerCreateResponse:s}}catch(n){throw i.setStatus({code:q.SpanStatusCode.ERROR,message:n.message}),n}finally{i.end()}}async deleteContainer(e,a={}){let{span:i,updatedOptions:r}=L("BlobServiceClient-deleteContainer",a);try{return await this.getContainerClient(e).delete(r)}catch(n){throw i.setStatus({code:q.SpanStatusCode.ERROR,message:n.message}),n}finally{i.end()}}async undeleteContainer(e,a,i={}){let{span:r,updatedOptions:n}=L("BlobServiceClient-undeleteContainer",i);try{let s=this.getContainerClient(i.destinationContainerName||e),p=await new gr(s.storageClientContext).restore(Object.assign({deletedContainerName:e,deletedContainerVersion:a},n));return{containerClient:s,containerUndeleteResponse:p}}catch(s){throw r.setStatus({code:q.SpanStatusCode.ERROR,message:s.message}),s}finally{r.end()}}async renameContainer(e,a,i={}){var r;let{span:n,updatedOptions:s}=L("BlobServiceClient-renameContainer",i);try{let o=this.getContainerClient(a),d=await new gr(o.storageClientContext).rename(e,Object.assign(Object.assign({},s),{sourceLeaseId:(r=i.sourceCondition)===null||r===void 0?void 0:r.leaseId}));return{containerClient:o,containerRenameResponse:d}}catch(o){throw n.setStatus({code:q.SpanStatusCode.ERROR,message:o.message}),o}finally{n.end()}}async getProperties(e={}){let{span:a,updatedOptions:i}=L("BlobServiceClient-getProperties",e);try{return await this.serviceContext.getProperties(Object.assign({abortSignal:e.abortSignal},G(i)))}catch(r){throw a.setStatus({code:q.SpanStatusCode.ERROR,message:r.message}),r}finally{a.end()}}async setProperties(e,a={}){let{span:i,updatedOptions:r}=L("BlobServiceClient-setProperties",a);try{return await this.serviceContext.setProperties(e,Object.assign({abortSignal:a.abortSignal},G(r)))}catch(n){throw i.setStatus({code:q.SpanStatusCode.ERROR,message:n.message}),n}finally{i.end()}}async getStatistics(e={}){let{span:a,updatedOptions:i}=L("BlobServiceClient-getStatistics",e);try{return await this.serviceContext.getStatistics(Object.assign({abortSignal:e.abortSignal},G(i)))}catch(r){throw a.setStatus({code:q.SpanStatusCode.ERROR,message:r.message}),r}finally{a.end()}}async getAccountInfo(e={}){let{span:a,updatedOptions:i}=L("BlobServiceClient-getAccountInfo",e);try{return await this.serviceContext.getAccountInfo(Object.assign({abortSignal:e.abortSignal},G(i)))}catch(r){throw a.setStatus({code:q.SpanStatusCode.ERROR,message:r.message}),r}finally{a.end()}}async listContainersSegment(e,a={}){let{span:i,updatedOptions:r}=L("BlobServiceClient-listContainersSegment",a);try{return await this.serviceContext.listContainersSegment(Object.assign(Object.assign(Object.assign({abortSignal:a.abortSignal,marker:e},a),{include:typeof a.include=="string"?[a.include]:a.include}),G(r)))}catch(n){throw i.setStatus({code:q.SpanStatusCode.ERROR,message:n.message}),n}finally{i.end()}}async findBlobsByTagsSegment(e,a,i={}){let{span:r,updatedOptions:n}=L("BlobServiceClient-findBlobsByTagsSegment",i);try{let s=await this.serviceContext.filterBlobs(Object.assign({abortSignal:i.abortSignal,where:e,marker:a,maxPageSize:i.maxPageSize},G(n)));return Object.assign(Object.assign({},s),{_response:s._response,blobs:s.blobs.map(p=>{var d;let l="";return((d=p.tags)===null||d===void 0?void 0:d.blobTagSet.length)===1&&(l=p.tags.blobTagSet[0].value),Object.assign(Object.assign({},p),{tags:Bs(p.tags),tagValue:l})})})}catch(s){throw r.setStatus({code:q.SpanStatusCode.ERROR,message:s.message}),s}finally{r.end()}}findBlobsByTagsSegments(e,a,i={}){return k.__asyncGenerator(this,arguments,function*(){let n;if(a||a===void 0)do n=yield k.__await(this.findBlobsByTagsSegment(e,a,i)),n.blobs=n.blobs||[],a=n.continuationToken,yield yield k.__await(n);while(a)})}findBlobsByTagsItems(e,a={}){return k.__asyncGenerator(this,arguments,function*(){var r,n;let s;try{for(var o=k.__asyncValues(this.findBlobsByTagsSegments(e,s,a)),p;p=yield k.__await(o.next()),!p.done;){let d=p.value;yield k.__await(yield*k.__asyncDelegator(k.__asyncValues(d.blobs)))}}catch(d){r={error:d}}finally{try{p&&!p.done&&(n=o.return)&&(yield k.__await(n.call(o)))}finally{if(r)throw r.error}}})}findBlobsByTags(e,a={}){let i=Object.assign({},a),r=this.findBlobsByTagsItems(e,i);return{next(){return r.next()},[Symbol.asyncIterator](){return this},byPage:(n={})=>this.findBlobsByTagsSegments(e,n.continuationToken,Object.assign({maxPageSize:n.maxPageSize},i))}}listSegments(e,a={}){return k.__asyncGenerator(this,arguments,function*(){let r;if(e||e===void 0)do r=yield k.__await(this.listContainersSegment(e,a)),r.containerItems=r.containerItems||[],e=r.continuationToken,yield yield k.__await(yield k.__await(r));while(e)})}listItems(e={}){return k.__asyncGenerator(this,arguments,function*(){var i,r;let n;try{for(var s=k.__asyncValues(this.listSegments(n,e)),o;o=yield k.__await(s.next()),!o.done;){let p=o.value;yield k.__await(yield*k.__asyncDelegator(k.__asyncValues(p.containerItems)))}}catch(p){i={error:p}}finally{try{o&&!o.done&&(r=s.return)&&(yield k.__await(r.call(s)))}finally{if(i)throw i.error}}})}listContainers(e={}){e.prefix===""&&(e.prefix=void 0);let a=[];e.includeDeleted&&a.push("deleted"),e.includeMetadata&&a.push("metadata"),e.includeSystem&&a.push("system");let i=Object.assign(Object.assign({},e),a.length>0?{include:a}:{}),r=this.listItems(i);return{next(){return r.next()},[Symbol.asyncIterator](){return this},byPage:(n={})=>this.listSegments(n.continuationToken,Object.assign({maxPageSize:n.maxPageSize},i))}}async getUserDelegationKey(e,a,i={}){let{span:r,updatedOptions:n}=L("BlobServiceClient-getUserDelegationKey",i);try{let s=await this.serviceContext.getUserDelegationKey({startsOn:Ne(e,!1),expiresOn:Ne(a,!1)},Object.assign({abortSignal:i.abortSignal},G(n))),o={signedObjectId:s.signedObjectId,signedTenantId:s.signedTenantId,signedStartsOn:new Date(s.signedStartsOn),signedExpiresOn:new Date(s.signedExpiresOn),signedService:s.signedService,signedVersion:s.signedVersion,value:s.value};return Object.assign({_response:s._response,requestId:s.requestId,clientRequestId:s.clientRequestId,version:s.version,date:s.date,errorCode:s.errorCode},o)}catch(s){throw r.setStatus({code:q.SpanStatusCode.ERROR,message:s.message}),s}finally{r.end()}}getBlobBatchClient(){return new Xs(this.url,this.pipeline)}generateAccountSasUrl(e,a=Ws.parse("r"),i="sco",r={}){if(!(this.credential instanceof Ve))throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");if(e===void 0){let s=new Date;e=new Date(s.getTime()+3600*1e3)}let n=pv(Object.assign({permissions:a,expiresOn:e,resourceTypes:i,services:Ks.parse("b").toString()},r),this.credential).toString();return m0(this.url,n)}};Y.KnownEncryptionAlgorithmType=void 0;(function(t){t.AES256="AES256"})(Y.KnownEncryptionAlgorithmType||(Y.KnownEncryptionAlgorithmType={}));Object.defineProperty(Y,"BaseRequestPolicy",{enumerable:!0,get:function(){return M.BaseRequestPolicy}});Object.defineProperty(Y,"HttpHeaders",{enumerable:!0,get:function(){return M.HttpHeaders}});Object.defineProperty(Y,"RequestPolicyOptions",{enumerable:!0,get:function(){return M.RequestPolicyOptions}});Object.defineProperty(Y,"RestError",{enumerable:!0,get:function(){return M.RestError}});Object.defineProperty(Y,"WebResource",{enumerable:!0,get:function(){return M.WebResource}});Object.defineProperty(Y,"deserializationPolicy",{enumerable:!0,get:function(){return M.deserializationPolicy}});Y.AccountSASPermissions=Ws;Y.AccountSASResourceTypes=Vd;Y.AccountSASServices=Ks;Y.AnonymousCredential=Te;Y.AnonymousCredentialPolicy=kd;Y.AppendBlobClient=Vs;Y.BlobBatch=pn;Y.BlobBatchClient=Xs;Y.BlobClient=ba;Y.BlobLeaseClient=Fs;Y.BlobSASPermissions=ii;Y.BlobServiceClient=$u;Y.BlockBlobClient=$s;Y.ContainerClient=Fd;Y.ContainerSASPermissions=ri;Y.Credential=js;Y.CredentialPolicy=Ls;Y.PageBlobClient=Gs;Y.Pipeline=ks;Y.SASQueryParameters=La;Y.StorageBrowserPolicy=Md;Y.StorageBrowserPolicyFactory=qd;Y.StorageOAuthScopes=l0;Y.StorageRetryPolicy=Ld;Y.StorageRetryPolicyFactory=jd;Y.StorageSharedKeyCredential=Ve;Y.StorageSharedKeyCredentialPolicy=Hd;Y.generateAccountSASQueryParameters=pv;Y.generateBlobSASQueryParameters=f0;Y.isPipelineLike=Fi;Y.logger=xa;Y.newPipeline=Oe});var g0=T($e=>{"use strict";var GB=$e&&$e.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),XB=$e&&$e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WB=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&GB(e,t,a);return XB(e,t),e},Jd=$e&&$e.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty($e,"__esModule",{value:!0});$e.retryHttpClientResponse=$e.retryTypedResponse=$e.retry=$e.isRetryableStatusCode=$e.isServerErrorStatusCode=$e.isSuccessStatusCode=void 0;var lv=WB(gt()),Zd=Or(),Pn=Zn();function KB(t){return t?t>=200&&t<300:!1}$e.isSuccessStatusCode=KB;function cv(t){return t?t>=500:!0}$e.isServerErrorStatusCode=cv;function mv(t){return t?[Zd.HttpCodes.BadGateway,Zd.HttpCodes.ServiceUnavailable,Zd.HttpCodes.GatewayTimeout].includes(t):!1}$e.isRetryableStatusCode=mv;function QB(t){return Jd(this,void 0,void 0,function*(){return new Promise(e=>setTimeout(e,t))})}function h0(t,e,a,i=Pn.DefaultRetryAttempts,r=Pn.DefaultRetryDelay,n=void 0){return Jd(this,void 0,void 0,function*(){let s="",o=1;for(;o<=i;){let p,d,l=!1;try{p=yield e()}catch(c){n&&(p=n(c)),l=!0,s=c.message}if(p&&(d=a(p),!cv(d)))return p;if(d&&(l=mv(d),s=`Cache service responded with ${d}`),lv.debug(`${t} - Attempt ${o} of ${i} failed with error: ${s}`),!l){lv.debug(`${t} - Error is not retryable`);break}yield QB(r),o++}throw Error(`${t} failed: ${s}`)})}$e.retry=h0;function YB(t,e,a=Pn.DefaultRetryAttempts,i=Pn.DefaultRetryDelay){return Jd(this,void 0,void 0,function*(){return yield h0(t,e,r=>r.statusCode,a,i,r=>{if(r instanceof Zd.HttpClientError)return{statusCode:r.statusCode,result:null,headers:{},error:r}})})}$e.retryTypedResponse=YB;function ZB(t,e,a=Pn.DefaultRetryAttempts,i=Pn.DefaultRetryDelay){return Jd(this,void 0,void 0,function*(){return yield h0(t,e,r=>r.message.statusCode,a,i)})}$e.retryHttpClientResponse=ZB});var yv=T(ut=>{"use strict";var JB=ut&&ut.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),eA=ut&&ut.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),On=ut&&ut.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&JB(e,t,a);return eA(e,t),e},sa=ut&&ut.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(ut,"__esModule",{value:!0});ut.downloadCacheStorageSDK=ut.downloadCacheHttpClientConcurrent=ut.downloadCacheHttpClient=ut.DownloadProgress=void 0;var eo=On(gt()),fv=Or(),tA=dv(),aA=On(require("buffer")),Js=On(require("fs")),iA=On(require("stream")),rA=On(require("util")),nA=On(es()),uv=Zn(),y0=g0(),sA=kr();function oA(t,e){return sa(this,void 0,void 0,function*(){yield rA.promisify(iA.pipeline)(t.message,e)})}var to=class{constructor(e){this.contentLength=e,this.segmentIndex=0,this.segmentSize=0,this.segmentOffset=0,this.receivedBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}nextSegment(e){this.segmentOffset=this.segmentOffset+this.segmentSize,this.segmentIndex=this.segmentIndex+1,this.segmentSize=e,this.receivedBytes=0,eo.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`)}setReceivedBytes(e){this.receivedBytes=e}getTransferredBytes(){return this.segmentOffset+this.receivedBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.segmentOffset+this.receivedBytes,a=(100*(e/this.contentLength)).toFixed(1),i=Date.now()-this.startTime,r=(e/(1024*1024)/(i/1e3)).toFixed(1);eo.info(`Received ${e} of ${this.contentLength} (${a}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setReceivedBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let a=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(a,e))};this.timeoutHandle=setTimeout(a,e)}stopDisplayTimer(){this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0),this.display()}};ut.DownloadProgress=to;function hv(t,e){return sa(this,void 0,void 0,function*(){let a=Js.createWriteStream(e),i=new fv.HttpClient("actions/cache"),r=yield(0,y0.retryHttpClientResponse)("downloadCache",()=>sa(this,void 0,void 0,function*(){return i.get(t)}));r.message.socket.setTimeout(uv.SocketTimeout,()=>{r.message.destroy(),eo.debug(`Aborting download, socket timed out after ${uv.SocketTimeout} ms`)}),yield oA(r,a);let n=r.message.headers["content-length"];if(n){let s=parseInt(n),o=nA.getArchiveFileSizeInBytes(e);if(o!==s)throw new Error(`Incomplete download. Expected file size: ${s}, actual file size: ${o}`)}else eo.debug("Unable to validate download, no Content-Length header")})}ut.downloadCacheHttpClient=hv;function pA(t,e,a){var i;return sa(this,void 0,void 0,function*(){let r=yield Js.promises.open(e,"w"),n=new fv.HttpClient("actions/cache",void 0,{socketTimeout:a.timeoutInMs,keepAlive:!0});try{let o=(yield(0,y0.retryHttpClientResponse)("downloadCacheMetadata",()=>sa(this,void 0,void 0,function*(){return yield n.request("HEAD",t,null,{})}))).message.headers["content-length"];if(o==null)throw new Error("Content-Length not found on blob response");let p=parseInt(o);if(Number.isNaN(p))throw new Error(`Could not interpret Content-Length: ${p}`);let d=[],l=4*1024*1024;for(let R=0;Rsa(this,void 0,void 0,function*(){return yield dA(n,t,R,b)})})}d.reverse();let c=0,m=0,u=new to(p);u.startDisplayTimer();let h=u.onProgress(),v=[],E,S=()=>sa(this,void 0,void 0,function*(){let R=yield Promise.race(Object.values(v));yield r.write(R.buffer,0,R.count,R.offset),c--,delete v[R.offset],m+=R.count,h({loadedBytes:m})});for(;E=d.pop();)v[E.offset]=E.promiseGetter(),c++,c>=((i=a.downloadConcurrency)!==null&&i!==void 0?i:10)&&(yield S());for(;c>0;)yield S()}finally{n.dispose(),yield r.close()}})}ut.downloadCacheHttpClientConcurrent=pA;function dA(t,e,a,i){return sa(this,void 0,void 0,function*(){let n=0;for(;;)try{let o=yield gv(3e4,lA(t,e,a,i));if(typeof o=="string")throw new Error("downloadSegmentRetry failed due to timeout");return o}catch(s){if(n>=5)throw s;n++}})}function lA(t,e,a,i){return sa(this,void 0,void 0,function*(){let r=yield(0,y0.retryHttpClientResponse)("downloadCachePart",()=>sa(this,void 0,void 0,function*(){return yield t.get(e,{Range:`bytes=${a}-${a+i-1}`})}));if(!r.readBodyBuffer)throw new Error("Expected HttpClientResponse to implement readBodyBuffer");return{offset:a,count:i,buffer:yield r.readBodyBuffer()}})}function cA(t,e,a){var i;return sa(this,void 0,void 0,function*(){let r=new tA.BlockBlobClient(t,void 0,{retryOptions:{tryTimeoutInMs:a.timeoutInMs}}),s=(i=(yield r.getProperties()).contentLength)!==null&&i!==void 0?i:-1;if(s<0)eo.debug("Unable to determine content length, downloading file with http-client..."),yield hv(t,e);else{let o=Math.min(134217728,aA.constants.MAX_LENGTH),p=new to(s),d=Js.openSync(e,"w");try{p.startDisplayTimer();let l=new sA.AbortController,c=l.signal;for(;!p.isDone();){let m=p.segmentOffset+p.segmentSize,u=Math.min(o,s-m);p.nextSegment(u);let h=yield gv(a.segmentTimeoutInMs||36e5,r.downloadToBuffer(m,u,{abortSignal:c,concurrency:a.downloadConcurrency,onProgress:p.onProgress()}));if(h==="timeout")throw l.abort(),new Error("Aborting cache download as the download time exceeded the timeout.");Buffer.isBuffer(h)&&Js.writeFileSync(d,h)}}finally{p.stopDisplayTimer(),Js.closeSync(d)}}})}ut.downloadCacheStorageSDK=cA;var gv=(t,e)=>sa(void 0,void 0,void 0,function*(){let a,i=new Promise(r=>{a=setTimeout(()=>r("timeout"),t)});return Promise.race([e,i]).then(r=>(clearTimeout(a),r))})});var vv=T(oa=>{"use strict";var mA=oa&&oa.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),uA=oa&&oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fA=oa&&oa.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&mA(e,t,a);return uA(e,t),e};Object.defineProperty(oa,"__esModule",{value:!0});oa.getDownloadOptions=oa.getUploadOptions=void 0;var Vi=fA(gt());function hA(t){let e={uploadConcurrency:4,uploadChunkSize:33554432};return t&&(typeof t.uploadConcurrency=="number"&&(e.uploadConcurrency=t.uploadConcurrency),typeof t.uploadChunkSize=="number"&&(e.uploadChunkSize=t.uploadChunkSize)),Vi.debug(`Upload concurrency: ${e.uploadConcurrency}`),Vi.debug(`Upload chunk size: ${e.uploadChunkSize}`),e}oa.getUploadOptions=hA;function gA(t){let e={useAzureSdk:!1,concurrentBlobDownloads:!0,downloadConcurrency:8,timeoutInMs:3e4,segmentTimeoutInMs:6e5,lookupOnly:!1};t&&(typeof t.useAzureSdk=="boolean"&&(e.useAzureSdk=t.useAzureSdk),typeof t.concurrentBlobDownloads=="boolean"&&(e.concurrentBlobDownloads=t.concurrentBlobDownloads),typeof t.downloadConcurrency=="number"&&(e.downloadConcurrency=t.downloadConcurrency),typeof t.timeoutInMs=="number"&&(e.timeoutInMs=t.timeoutInMs),typeof t.segmentTimeoutInMs=="number"&&(e.segmentTimeoutInMs=t.segmentTimeoutInMs),typeof t.lookupOnly=="boolean"&&(e.lookupOnly=t.lookupOnly));let a=process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS;return a&&!isNaN(Number(a))&&isFinite(Number(a))&&(e.segmentTimeoutInMs=Number(a)*60*1e3),Vi.debug(`Use Azure SDK: ${e.useAzureSdk}`),Vi.debug(`Download concurrency: ${e.downloadConcurrency}`),Vi.debug(`Request timeout (ms): ${e.timeoutInMs}`),Vi.debug(`Cache segment download timeout mins env var: ${process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS}`),Vi.debug(`Segment download timeout (ms): ${e.segmentTimeoutInMs}`),Vi.debug(`Lookup only: ${e.lookupOnly}`),e}oa.getDownloadOptions=gA});var wv=T(Qe=>{"use strict";var yA=Qe&&Qe.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),vA=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),al=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&yA(e,t,a);return vA(e,t),e},kt=Qe&&Qe.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.saveCache=Qe.reserveCache=Qe.downloadCache=Qe.getCacheEntry=Qe.getCacheVersion=void 0;var Wt=al(gt()),xA=Or(),bA=Rl(),wA=al(require("crypto")),v0=al(require("fs")),NA=require("url"),tl=al(es()),el=yv(),bv=vv(),$i=g0(),_A="1.0";function ao(t){let e=process.env.ACTIONS_CACHE_URL||"";if(!e)throw new Error("Cache Service Url not found, unable to restore cache.");let a=`${e}_apis/artifactcache/${t}`;return Wt.debug(`Resource Url: ${a}`),a}function SA(t,e){return`${t};api-version=${e}`}function EA(){return{headers:{Accept:SA("application/json","6.0-preview.1")}}}function x0(){let t=process.env.ACTIONS_RUNTIME_TOKEN||"",e=new bA.BearerCredentialHandler(t);return new xA.HttpClient("actions/cache",[e],EA())}function b0(t,e,a=!1){let i=t;return e&&i.push(e),process.platform==="win32"&&!a&&i.push("windows-only"),i.push(_A),wA.createHash("sha256").update(i.join("|")).digest("hex")}Qe.getCacheVersion=b0;function CA(t,e,a){return kt(this,void 0,void 0,function*(){let i=x0(),r=b0(e,a?.compressionMethod,a?.enableCrossOsArchive),n=`cache?keys=${encodeURIComponent(t.join(","))}&version=${r}`,s=yield(0,$i.retryTypedResponse)("getCacheEntry",()=>kt(this,void 0,void 0,function*(){return i.getJson(ao(n))}));if(s.statusCode===204)return Wt.isDebug()&&(yield TA(t[0],i,r)),null;if(!(0,$i.isSuccessStatusCode)(s.statusCode))throw new Error(`Cache service responded with ${s.statusCode}`);let o=s.result,p=o?.archiveLocation;if(!p)throw new Error("Cache not found.");return Wt.setSecret(p),Wt.debug("Cache Result:"),Wt.debug(JSON.stringify(o)),o})}Qe.getCacheEntry=CA;function TA(t,e,a){return kt(this,void 0,void 0,function*(){let i=`caches?key=${encodeURIComponent(t)}`,r=yield(0,$i.retryTypedResponse)("listCache",()=>kt(this,void 0,void 0,function*(){return e.getJson(ao(i))}));if(r.statusCode===200){let n=r.result,s=n?.totalCount;if(s&&s>0){Wt.debug(`No matching cache found for cache key '${t}', version '${a} and scope ${process.env.GITHUB_REF}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key Other caches with similar key:`);for(let o of n?.artifactCaches||[])Wt.debug(`Cache Key: ${o?.cacheKey}, Cache Version: ${o?.cacheVersion}, Cache Scope: ${o?.scope}, Cache Created: ${o?.creationTime}`)}}})}function PA(t,e,a){return kt(this,void 0,void 0,function*(){let i=new NA.URL(t),r=(0,bv.getDownloadOptions)(a);i.hostname.endsWith(".blob.core.windows.net")?r.useAzureSdk?yield(0,el.downloadCacheStorageSDK)(t,e,r):r.concurrentBlobDownloads?yield(0,el.downloadCacheHttpClientConcurrent)(t,e,r):yield(0,el.downloadCacheHttpClient)(t,e):yield(0,el.downloadCacheHttpClient)(t,e)})}Qe.downloadCache=PA;function OA(t,e,a){return kt(this,void 0,void 0,function*(){let i=x0(),r=b0(e,a?.compressionMethod,a?.enableCrossOsArchive),n={key:t,version:r,cacheSize:a?.cacheSize};return yield(0,$i.retryTypedResponse)("reserveCache",()=>kt(this,void 0,void 0,function*(){return i.postJson(ao("caches"),n)}))})}Qe.reserveCache=OA;function xv(t,e){return`bytes ${t}-${e}/*`}function RA(t,e,a,i,r){return kt(this,void 0,void 0,function*(){Wt.debug(`Uploading chunk of size ${r-i+1} bytes at offset ${i} with content range: ${xv(i,r)}`);let n={"Content-Type":"application/octet-stream","Content-Range":xv(i,r)},s=yield(0,$i.retryHttpClientResponse)(`uploadChunk (start: ${i}, end: ${r})`,()=>kt(this,void 0,void 0,function*(){return t.sendStream("PATCH",e,a(),n)}));if(!(0,$i.isSuccessStatusCode)(s.message.statusCode))throw new Error(`Cache service responded with ${s.message.statusCode} during upload chunk.`)})}function DA(t,e,a,i){return kt(this,void 0,void 0,function*(){let r=tl.getArchiveFileSizeInBytes(a),n=ao(`caches/${e.toString()}`),s=v0.openSync(a,"r"),o=(0,bv.getUploadOptions)(i),p=tl.assertDefined("uploadConcurrency",o.uploadConcurrency),d=tl.assertDefined("uploadChunkSize",o.uploadChunkSize),l=[...new Array(p).keys()];Wt.debug("Awaiting all uploads");let c=0;try{yield Promise.all(l.map(()=>kt(this,void 0,void 0,function*(){for(;cv0.createReadStream(a,{fd:s,start:u,end:h,autoClose:!1}).on("error",v=>{throw new Error(`Cache upload failed because file read failed with ${v.message}`)}),u,h)}})))}finally{v0.closeSync(s)}})}function IA(t,e,a){return kt(this,void 0,void 0,function*(){let i={size:a};return yield(0,$i.retryTypedResponse)("commitCache",()=>kt(this,void 0,void 0,function*(){return t.postJson(ao(`caches/${e.toString()}`),i)}))})}function BA(t,e,a){return kt(this,void 0,void 0,function*(){let i=x0();Wt.debug("Upload cache"),yield DA(i,t,e,a),Wt.debug("Commiting cache");let r=tl.getArchiveFileSizeInBytes(e);Wt.info(`Cache Size: ~${Math.round(r/(1024*1024))} MB (${r} B)`);let n=yield IA(i,t,r);if(!(0,$i.isSuccessStatusCode)(n.statusCode))throw new Error(`Cache service responded with ${n.statusCode} during commit cache.`);Wt.info("Cache saved successfully")})}Qe.saveCache=BA});var Sv=T(_t=>{"use strict";var AA=_t&&_t.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),zA=_t&&_t.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w0=_t&&_t.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&AA(e,t,a);return zA(e,t),e},pi=_t&&_t.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(_t,"__esModule",{value:!0});_t.createTar=_t.extractTar=_t.listTar=void 0;var MA=jn(),il=w0(Ln()),Nv=require("fs"),Na=w0(require("path")),N0=w0(es()),Ie=Zn(),Gi=process.platform==="win32";function qA(){return pi(this,void 0,void 0,function*(){switch(process.platform){case"win32":{let t=yield N0.getGnuTarPathOnWindows(),e=Ie.SystemTarPathOnWindows;if(t)return{path:t,type:Ie.ArchiveToolType.GNU};if((0,Nv.existsSync)(e))return{path:e,type:Ie.ArchiveToolType.BSD};break}case"darwin":{let t=yield il.which("gtar",!1);return t?{path:t,type:Ie.ArchiveToolType.GNU}:{path:yield il.which("tar",!0),type:Ie.ArchiveToolType.BSD}}default:break}return{path:yield il.which("tar",!0),type:Ie.ArchiveToolType.GNU}})}function LA(t,e,a,i=""){return pi(this,void 0,void 0,function*(){let r=[`"${t.path}"`],n=N0.getCacheFileName(e),s="cache.tar",o=_v(),p=t.type===Ie.ArchiveToolType.BSD&&e!==Ie.CompressionMethod.Gzip&&Gi;switch(a){case"create":r.push("--posix","-cf",p?s:n.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),"--exclude",p?s:n.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),"-P","-C",o.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),"--files-from",Ie.ManifestFilename);break;case"extract":r.push("-xf",p?s:i.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),"-P","-C",o.replace(new RegExp(`\\${Na.sep}`,"g"),"/"));break;case"list":r.push("-tf",p?s:i.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),"-P");break}if(t.type===Ie.ArchiveToolType.GNU)switch(process.platform){case"win32":r.push("--force-local");break;case"darwin":r.push("--delay-directory-restore");break}return r})}function _0(t,e,a=""){return pi(this,void 0,void 0,function*(){let i,r=yield qA(),n=yield LA(r,t,e,a),s=e!=="create"?yield jA(r,t,a):yield kA(r,t),o=r.type===Ie.ArchiveToolType.BSD&&t!==Ie.CompressionMethod.Gzip&&Gi;return o&&e!=="create"?i=[[...s].join(" "),[...n].join(" ")]:i=[[...n].join(" "),[...s].join(" ")],o?i:[i.join(" ")]})}function _v(){var t;return(t=process.env.GITHUB_WORKSPACE)!==null&&t!==void 0?t:process.cwd()}function jA(t,e,a){return pi(this,void 0,void 0,function*(){let i=t.type===Ie.ArchiveToolType.BSD&&e!==Ie.CompressionMethod.Gzip&&Gi;switch(e){case Ie.CompressionMethod.Zstd:return i?["zstd -d --long=30 --force -o",Ie.TarFilename,a.replace(new RegExp(`\\${Na.sep}`,"g"),"/")]:["--use-compress-program",Gi?'"zstd -d --long=30"':"unzstd --long=30"];case Ie.CompressionMethod.ZstdWithoutLong:return i?["zstd -d --force -o",Ie.TarFilename,a.replace(new RegExp(`\\${Na.sep}`,"g"),"/")]:["--use-compress-program",Gi?'"zstd -d"':"unzstd"];default:return["-z"]}})}function kA(t,e){return pi(this,void 0,void 0,function*(){let a=N0.getCacheFileName(e),i=t.type===Ie.ArchiveToolType.BSD&&e!==Ie.CompressionMethod.Gzip&&Gi;switch(e){case Ie.CompressionMethod.Zstd:return i?["zstd -T0 --long=30 --force -o",a.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),Ie.TarFilename]:["--use-compress-program",Gi?'"zstd -T0 --long=30"':"zstdmt --long=30"];case Ie.CompressionMethod.ZstdWithoutLong:return i?["zstd -T0 --force -o",a.replace(new RegExp(`\\${Na.sep}`,"g"),"/"),Ie.TarFilename]:["--use-compress-program",Gi?'"zstd -T0"':"zstdmt"];default:return["-z"]}})}function S0(t,e){return pi(this,void 0,void 0,function*(){for(let a of t)try{yield(0,MA.exec)(a,void 0,{cwd:e,env:Object.assign(Object.assign({},process.env),{MSYS:"winsymlinks:nativestrict"})})}catch(i){throw new Error(`${a.split(" ")[0]} failed with error: ${i?.message}`)}})}function HA(t,e){return pi(this,void 0,void 0,function*(){let a=yield _0(e,"list",t);yield S0(a)})}_t.listTar=HA;function UA(t,e){return pi(this,void 0,void 0,function*(){let a=_v();yield il.mkdirP(a);let i=yield _0(e,"extract",t);yield S0(i)})}_t.extractTar=UA;function FA(t,e,a){return pi(this,void 0,void 0,function*(){(0,Nv.writeFileSync)(Na.join(t,Ie.ManifestFilename),e.join(` `));let i=yield _0(a,"create");yield S0(i,t)})}_t.createTar=FA});var Ov=T(Ye=>{"use strict";var VA=Ye&&Ye.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a);var r=Object.getOwnPropertyDescriptor(e,a);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[a]}}),Object.defineProperty(t,i,r)}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),$A=Ye&&Ye.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sl=Ye&&Ye.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.prototype.hasOwnProperty.call(t,a)&&VA(e,t,a);return $A(e,t),e},Ev=Ye&&Ye.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.saveCache=Ye.restoreCache=Ye.isFeatureAvailable=Ye.ReserveCacheError=Ye.ValidationError=void 0;var it=sl(gt()),Cv=sl(require("path")),pa=sl(es()),rl=sl(wv()),nl=Sv(),di=class t extends Error{constructor(e){super(e),this.name="ValidationError",Object.setPrototypeOf(this,t.prototype)}};Ye.ValidationError=di;var io=class t extends Error{constructor(e){super(e),this.name="ReserveCacheError",Object.setPrototypeOf(this,t.prototype)}};Ye.ReserveCacheError=io;function Tv(t){if(!t||t.length===0)throw new di("Path Validation Error: At least one directory or file path is required")}function Pv(t){if(t.length>512)throw new di(`Key Validation Error: ${t} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(t))throw new di(`Key Validation Error: ${t} cannot contain commas.`)}function GA(){return!!process.env.ACTIONS_CACHE_URL}Ye.isFeatureAvailable=GA;function XA(t,e,a,i,r=!1){return Ev(this,void 0,void 0,function*(){Tv(t),a=a||[];let n=[e,...a];if(it.debug("Resolved Keys:"),it.debug(JSON.stringify(n)),n.length>10)throw new di("Key Validation Error: Keys are limited to a maximum of 10.");for(let p of n)Pv(p);let s=yield pa.getCompressionMethod(),o="";try{let p=yield rl.getCacheEntry(n,t,{compressionMethod:s,enableCrossOsArchive:r});if(!p?.archiveLocation)return;if(i?.lookupOnly)return it.info("Lookup only - skipping download"),p.cacheKey;o=Cv.join(yield pa.createTempDirectory(),pa.getCacheFileName(s)),it.debug(`Archive Path: ${o}`),yield rl.downloadCache(p.archiveLocation,o,i),it.isDebug()&&(yield(0,nl.listTar)(o,s));let d=pa.getArchiveFileSizeInBytes(o);return it.info(`Cache Size: ~${Math.round(d/(1024*1024))} MB (${d} B)`),yield(0,nl.extractTar)(o,s),it.info("Cache restored successfully"),p.cacheKey}catch(p){if(p.name===di.name)throw p;it.warning(`Failed to restore: ${p.message}`)}finally{try{yield pa.unlinkFile(o)}catch(p){it.debug(`Failed to delete archive: ${p}`)}}})}Ye.restoreCache=XA;function WA(t,e,a,i=!1){var r,n,s,o,p;return Ev(this,void 0,void 0,function*(){Tv(t),Pv(e);let d=yield pa.getCompressionMethod(),l=-1,c=yield pa.resolvePaths(t);if(it.debug("Cache Paths:"),it.debug(`${JSON.stringify(c)}`),c.length===0)throw new Error("Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.");let m=yield pa.createTempDirectory(),u=Cv.join(m,pa.getCacheFileName(d));it.debug(`Archive Path: ${u}`);try{yield(0,nl.createTar)(m,c,d),it.isDebug()&&(yield(0,nl.listTar)(u,d));let h=10*1024*1024*1024,v=pa.getArchiveFileSizeInBytes(u);if(it.debug(`File Size: ${v}`),v>h&&!pa.isGhes())throw new Error(`Cache size of ~${Math.round(v/(1024*1024))} MB (${v} B) is over the 10GB limit, not saving cache.`);it.debug("Reserving Cache");let E=yield rl.reserveCache(e,t,{compressionMethod:d,enableCrossOsArchive:i,cacheSize:v});if(!((r=E?.result)===null||r===void 0)&&r.cacheId)l=(n=E?.result)===null||n===void 0?void 0:n.cacheId;else throw E?.statusCode===400?new Error((o=(s=E?.error)===null||s===void 0?void 0:s.message)!==null&&o!==void 0?o:`Cache size of ~${Math.round(v/(1024*1024))} MB (${v} B) is over the data cap limit, not saving cache.`):new io(`Unable to reserve cache with key ${e}, another job may be creating this cache. More details: ${(p=E?.error)===null||p===void 0?void 0:p.message}`);it.debug(`Saving Cache (ID: ${l})`),yield rl.saveCache(l,u,a)}catch(h){let v=h;if(v.name===di.name)throw h;v.name===io.name?it.info(`Failed to save: ${v.message}`):it.warning(`Failed to save: ${v.message}`)}finally{try{yield pa.unlinkFile(u)}catch(h){it.debug(`Failed to delete archive: ${h}`)}}return l})}Ye.saveCache=WA});var Iv=T((St,C0)=>{"use strict";var KA=St&&St.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[a]}})}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),QA=St&&St.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YA=St&&St.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.hasOwnProperty.call(t,a)&&KA(e,t,a);return QA(e,t),e},ZA=St&&St.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(St,"__esModule",{value:!0});St._readLinuxVersionFile=St._getOsVersion=St._findMatch=void 0;var Rv=YA(Mo()),E0=gt(),Dv=require("os"),JA=require("child_process"),ol=require("fs");function ez(t,e,a,i){return ZA(this,void 0,void 0,function*(){let r=Dv.platform(),n,s,o;for(let p of a){let d=p.version;if(E0.debug(`check ${d} satisfies ${t}`),Rv.satisfies(d,t)&&(!e||p.stable===e)&&(o=p.files.find(l=>{E0.debug(`${l.arch}===${i} && ${l.platform}===${r}`);let c=l.arch===i&&l.platform===r;if(c&&l.platform_version){let m=C0.exports._getOsVersion();m===l.platform_version?c=!0:c=Rv.satisfies(m,l.platform_version)}return c}),o)){E0.debug(`matched ${p.version}`),s=p;break}}return s&&o&&(n=Object.assign({},s),n.files=[o]),n})}St._findMatch=ez;function tz(){let t=Dv.platform(),e="";if(t==="darwin")e=JA.execSync("sw_vers -productVersion").toString();else if(t==="linux"){let a=C0.exports._readLinuxVersionFile();if(a){let i=a.split(` -`);for(let r of i){let n=r.split("=");if(n.length===2&&(n[0].trim()==="VERSION_ID"||n[0].trim()==="DISTRIB_RELEASE")){e=n[1].trim().replace(/^"/,"").replace(/"$/,"");break}}}}return e}St._getOsVersion=tz;function az(){let t="/etc/lsb-release",e="/etc/os-release",a="";return ol.existsSync(t)?a=ol.readFileSync(t).toString():ol.existsSync(e)&&(a=ol.readFileSync(e).toString()),a}St._readLinuxVersionFile=az});var zv=T(da=>{"use strict";var iz=da&&da.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[a]}})}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),rz=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nz=da&&da.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.hasOwnProperty.call(t,a)&&iz(e,t,a);return rz(e,t),e},Bv=da&&da.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(da,"__esModule",{value:!0});da.RetryHelper=void 0;var Av=nz(gt()),T0=class{constructor(e,a,i){if(e<1)throw new Error("max attempts should be greater than or equal to 1");if(this.maxAttempts=e,this.minSeconds=Math.floor(a),this.maxSeconds=Math.floor(i),this.minSeconds>this.maxSeconds)throw new Error("min seconds should be less than or equal to max seconds")}execute(e,a){return Bv(this,void 0,void 0,function*(){let i=1;for(;isetTimeout(a,e*1e3))})}};da.RetryHelper=T0});var Fv=T(re=>{"use strict";var sz=re&&re.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[a]}})}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),oz=re&&re.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ka=re&&re.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.hasOwnProperty.call(t,a)&&sz(e,t,a);return oz(e,t),e},Pt=re&&re.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})},pz=re&&re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(re,"__esModule",{value:!0});re.evaluateVersions=re.isExplicitVersion=re.findFromManifest=re.getManifestFromRepo=re.findAllVersions=re.find=re.cacheFile=re.cacheDir=re.extractZip=re.extractXar=re.extractTar=re.extract7z=re.downloadTool=re.HTTPError=void 0;var he=ka(gt()),Kt=ka(Ln()),la=ka(require("fs")),dz=ka(Iv()),no=ka(require("os")),_a=ka(require("path")),Mv=ka(Or()),li=ka(Mo()),lz=ka(require("stream")),cz=ka(require("util")),Rn=require("assert"),qv=pz(yc()),Xi=jn(),mz=zv(),ro=class extends Error{constructor(e){super(`Unexpected HTTP response: ${e}`),this.httpStatusCode=e,Object.setPrototypeOf(this,new.target.prototype)}};re.HTTPError=ro;var O0=process.platform==="win32",uz=process.platform==="darwin",fz="actions/tool-cache";function hz(t,e,a,i){return Pt(this,void 0,void 0,function*(){e=e||_a.join(Uv(),qv.default()),yield Kt.mkdirP(_a.dirname(e)),he.debug(`Downloading ${t}`),he.debug(`Destination ${e}`);let r=3,n=P0("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS",10),s=P0("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS",20);return yield new mz.RetryHelper(r,n,s).execute(()=>Pt(this,void 0,void 0,function*(){return yield gz(t,e||"",a,i)}),p=>!(p instanceof ro&&p.httpStatusCode&&p.httpStatusCode<500&&p.httpStatusCode!==408&&p.httpStatusCode!==429))})}re.downloadTool=hz;function gz(t,e,a,i){return Pt(this,void 0,void 0,function*(){if(la.existsSync(e))throw new Error(`Destination file path ${e} already exists`);let r=new Mv.HttpClient(fz,[],{allowRetries:!1});a&&(he.debug("set auth"),i===void 0&&(i={}),i.authorization=a);let n=yield r.get(t,i);if(n.message.statusCode!==200){let l=new ro(n.message.statusCode);throw he.debug(`Failed to download from "${t}". Code(${n.message.statusCode}) Message(${n.message.statusMessage})`),l}let s=cz.promisify(lz.pipeline),p=P0("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY",()=>n.message)(),d=!1;try{return yield s(p,la.createWriteStream(e)),he.debug("download complete"),d=!0,e}finally{if(!d){he.debug("download failed");try{yield Kt.rmRF(e)}catch(l){he.debug(`Failed to delete '${e}'. ${l.message}`)}}}})}function yz(t,e,a){return Pt(this,void 0,void 0,function*(){Rn.ok(O0,"extract7z() not supported on current OS"),Rn.ok(t,'parameter "file" is required'),e=yield pl(e);let i=process.cwd();if(process.chdir(e),a)try{let n=["x",he.isDebug()?"-bb1":"-bb0","-bd","-sccUTF-8",t],s={silent:!0};yield Xi.exec(`"${a}"`,n,s)}finally{process.chdir(i)}else{let r=_a.join(__dirname,"..","scripts","Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,""),n=t.replace(/'/g,"''").replace(/"|\n|\r/g,""),s=e.replace(/'/g,"''").replace(/"|\n|\r/g,""),p=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",`& '${r}' -Source '${n}' -Target '${s}'`],d={silent:!0};try{let l=yield Kt.which("powershell",!0);yield Xi.exec(`"${l}"`,p,d)}finally{process.chdir(i)}}return e})}re.extract7z=yz;function vz(t,e,a="xz"){return Pt(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'file' is required");e=yield pl(e),he.debug("Checking tar --version");let i="";yield Xi.exec("tar --version",[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:p=>i+=p.toString(),stderr:p=>i+=p.toString()}}),he.debug(i.trim());let r=i.toUpperCase().includes("GNU TAR"),n;a instanceof Array?n=a:n=[a],he.isDebug()&&!a.includes("v")&&n.push("-v");let s=e,o=t;return O0&&r&&(n.push("--force-local"),s=e.replace(/\\/g,"/"),o=t.replace(/\\/g,"/")),r&&(n.push("--warning=no-unknown-keyword"),n.push("--overwrite")),n.push("-C",s,"-f",o),yield Xi.exec("tar",n),e})}re.extractTar=vz;function xz(t,e,a=[]){return Pt(this,void 0,void 0,function*(){Rn.ok(uz,"extractXar() not supported on current OS"),Rn.ok(t,'parameter "file" is required'),e=yield pl(e);let i;a instanceof Array?i=a:i=[a],i.push("-x","-C",e,"-f",t),he.isDebug()&&i.push("-v");let r=yield Kt.which("xar",!0);return yield Xi.exec(`"${r}"`,Pz(i)),e})}re.extractXar=xz;function bz(t,e){return Pt(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'file' is required");return e=yield pl(e),O0?yield wz(t,e):yield Nz(t,e),e})}re.extractZip=bz;function wz(t,e){return Pt(this,void 0,void 0,function*(){let a=t.replace(/'/g,"''").replace(/"|\n|\r/g,""),i=e.replace(/'/g,"''").replace(/"|\n|\r/g,""),r=yield Kt.which("pwsh",!1);if(r){let s=["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ;","try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;",`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${a}', '${i}', $true) }`,`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${a}' -DestinationPath '${i}' -Force } else { throw $_ } } ;`].join(" ")];he.debug(`Using pwsh at path: ${r}`),yield Xi.exec(`"${r}"`,s)}else{let s=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ;","try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;",`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${a}' -DestinationPath '${i}' -Force }`,`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${a}', '${i}', $true) }`].join(" ")],o=yield Kt.which("powershell",!0);he.debug(`Using powershell at path: ${o}`),yield Xi.exec(`"${o}"`,s)}})}function Nz(t,e){return Pt(this,void 0,void 0,function*(){let a=yield Kt.which("unzip",!0),i=[t];he.isDebug()||i.unshift("-q"),i.unshift("-o"),yield Xi.exec(`"${a}"`,i,{cwd:e})})}function _z(t,e,a,i){return Pt(this,void 0,void 0,function*(){if(a=li.clean(a)||a,i=i||no.arch(),he.debug(`Caching tool ${e} ${a} ${i}`),he.debug(`source dir: ${t}`),!la.statSync(t).isDirectory())throw new Error("sourceDir is not a directory");let r=yield jv(e,a,i);for(let n of la.readdirSync(t)){let s=_a.join(t,n);yield Kt.cp(s,r,{recursive:!0})}return kv(e,a,i),r})}re.cacheDir=_z;function Sz(t,e,a,i,r){return Pt(this,void 0,void 0,function*(){if(i=li.clean(i)||i,r=r||no.arch(),he.debug(`Caching tool ${a} ${i} ${r}`),he.debug(`source file: ${t}`),!la.statSync(t).isFile())throw new Error("sourceFile is not a file");let n=yield jv(a,i,r),s=_a.join(n,e);return he.debug(`destination file ${s}`),yield Kt.cp(t,s),kv(a,i,r),n})}re.cacheFile=Sz;function Ez(t,e,a){if(!t)throw new Error("toolName parameter is required");if(!e)throw new Error("versionSpec parameter is required");if(a=a||no.arch(),!R0(e)){let r=Lv(t,a);e=Hv(r,e)}let i="";if(e){e=li.clean(e)||"";let r=_a.join(dl(),t,e,a);he.debug(`checking cache: ${r}`),la.existsSync(r)&&la.existsSync(`${r}.complete`)?(he.debug(`Found tool in cache ${t} ${e} ${a}`),i=r):he.debug("not found")}return i}re.find=Ez;function Lv(t,e){let a=[];e=e||no.arch();let i=_a.join(dl(),t);if(la.existsSync(i)){let r=la.readdirSync(i);for(let n of r)if(R0(n)){let s=_a.join(i,n,e||"");la.existsSync(s)&&la.existsSync(`${s}.complete`)&&a.push(n)}}return a}re.findAllVersions=Lv;function Cz(t,e,a,i="master"){return Pt(this,void 0,void 0,function*(){let r=[],n=`https://api.github.com/repos/${t}/${e}/git/trees/${i}`,s=new Mv.HttpClient("tool-cache"),o={};a&&(he.debug("set auth"),o.authorization=a);let p=yield s.getJson(n,o);if(!p.result)return r;let d="";for(let c of p.result.tree)if(c.path==="versions-manifest.json"){d=c.url;break}o.accept="application/vnd.github.VERSION.raw";let l=yield(yield s.get(d,o)).readBody();if(l){l=l.replace(/^\uFEFF/,"");try{r=JSON.parse(l)}catch{he.debug("Invalid json")}}return r})}re.getManifestFromRepo=Cz;function Tz(t,e,a,i=no.arch()){return Pt(this,void 0,void 0,function*(){return yield dz._findMatch(t,e,a,i)})}re.findFromManifest=Tz;function pl(t){return Pt(this,void 0,void 0,function*(){return t||(t=_a.join(Uv(),qv.default())),yield Kt.mkdirP(t),t})}function jv(t,e,a){return Pt(this,void 0,void 0,function*(){let i=_a.join(dl(),t,li.clean(e)||e,a||"");he.debug(`destination ${i}`);let r=`${i}.complete`;return yield Kt.rmRF(i),yield Kt.rmRF(r),yield Kt.mkdirP(i),i})}function kv(t,e,a){let r=`${_a.join(dl(),t,li.clean(e)||e,a||"")}.complete`;la.writeFileSync(r,""),he.debug("finished caching tool")}function R0(t){let e=li.clean(t)||"";he.debug(`isExplicit: ${e}`);let a=li.valid(e)!=null;return he.debug(`explicit? ${a}`),a}re.isExplicitVersion=R0;function Hv(t,e){let a="";he.debug(`evaluating ${t.length} versions`),t=t.sort((i,r)=>li.gt(i,r)?1:-1);for(let i=t.length-1;i>=0;i--){let r=t[i];if(li.satisfies(r,e)){a=r;break}}return a?he.debug(`matched: ${a}`):he.debug("match not found"),a}re.evaluateVersions=Hv;function dl(){let t=process.env.RUNNER_TOOL_CACHE||"";return Rn.ok(t,"Expected RUNNER_TOOL_CACHE to be defined"),t}function Uv(){let t=process.env.RUNNER_TEMP||"";return Rn.ok(t,"Expected RUNNER_TEMP to be defined"),t}function P0(t,e){let a=global[t];return a!==void 0?a:e}function Pz(t){return Array.from(new Set(t))}});var Yv=require("node:os"),A0=require("node:path"),In=require("node:fs"),Et=Ht(gt());var Xv=require("node:os"),Dn=require("node:path"),Ha=require("node:fs"),_r=Ht(gt()),ll=Ht(Ov()),oo=Ht(Fv()),I0=Ht(jn());var so=require("node:os"),Vv=require("node:fs"),$v=Ht(gt());function Oz(t){let{registryUrl:e,scope:a}=t,i;if(e)try{i=new URL(e)}catch{throw new Error(`Invalid registry-url: ${e}`)}let r;return a&&(r=a.startsWith("@")?a.toLocaleLowerCase():`@${a.toLocaleLowerCase()}`),i&&r?`[install.scopes]${so.EOL}'${r}' = { token = "$BUN_AUTH_TOKEN", url = "${i}"}${so.EOL}`:i&&!r?`[install]${so.EOL}registry = "${i}"${so.EOL}`:null}function Gv(t,e){let a=Oz(e);a&&((0,$v.info)(`Writing bunfig.toml to '${t}'.`),(0,Vv.appendFileSync)(t,a,{encoding:"utf8"}))}var Wv=Ht(gt());function D0(t,e){return t().catch(a=>{if(e<=0)throw a;return D0(t,e-1)})}var Kv=async t=>{let e=(0,Dn.join)(process.cwd(),"bunfig.toml");Gv(e,t);let a=Iz(t),i=Dz(t),r=(0,Dn.join)((0,Xv.homedir)(),".bun","bin");try{(0,Ha.mkdirSync)(r,{recursive:!0})}catch(c){if(c.code!=="EEXIST")throw c}(0,_r.addPath)(r);let n=c=>process.platform==="win32"?`${c}.exe`:c,s=(0,Dn.join)(r,n("bun"));try{(0,Ha.symlinkSync)(s,(0,Dn.join)(r,n("bunx")))}catch(c){if(c.code!=="EEXIST")throw c}let o,p=!1;if(i&&await(0,ll.restoreCache)([s],a)&&(o=await Qv(s),o?(p=!0,(0,_r.info)(`Using a cached version of Bun: ${o}`)):(0,_r.warning)(`Found a cached version of Bun: ${o} (but it appears to be corrupted?)`)),p||((0,_r.info)(`Downloading a new version of Bun: ${a}`),o=await D0(async()=>await Rz(a,s),3)),!o)throw new Error("Downloaded a new version of Bun, but failed to check its version? Try again.");let[d]=o.split("+");return(0,Wv.saveState)("cache",JSON.stringify({cacheEnabled:i,cacheHit:p,bunPath:s,url:a})),{version:d,revision:o,cacheHit:p}};async function Rz(t,e){let a=await(0,oo.downloadTool)(t),i=await(0,oo.extractZip)(a),r=await B0(i);try{(0,Ha.renameSync)(r,e)}catch{(0,Ha.copyFileSync)(r,e)}return await Qv(e)}function Dz(t){let{customUrl:e,version:a,noCache:i}=t;return i||e||!a||/latest|canary|action/i.test(a)?!1:(0,ll.isFeatureAvailable)()}function Iz(t){let{customUrl:e}=t;if(e)return e;let{version:a,os:i,arch:r,avx2:n,profile:s}=t,o=encodeURIComponent(a??"latest"),p=encodeURIComponent(i??process.platform),d=encodeURIComponent(r??process.arch),l=encodeURIComponent(n??!0),c=encodeURIComponent(s??!1),{href:m}=new URL(`${o}/${p}/${d}?avx2=${l}&profile=${c}`,"https://bun.sh/download/");return m}async function B0(t){for(let e of(0,Ha.readdirSync)(t,{withFileTypes:!0})){let{name:a}=e,i=(0,Dn.join)(t,a);if(e.isFile()){if(a==="bun"||a==="bun.exe")return i;if(/^bun.*\.zip/.test(a)){let r=await(0,oo.extractZip)(i);return B0(r)}}if(/^bun/.test(a)&&e.isDirectory())return B0(i)}throw new Error("Could not find executable: bun")}async function Qv(t){let e=await(0,I0.getExecOutput)(t,["--revision"],{ignoreReturnCode:!0});if(e.exitCode===0&&/^\d+\.\d+\.\d+/.test(e.stdout))return e.stdout.trim();let a=await(0,I0.getExecOutput)(t,["--version"],{ignoreReturnCode:!0});if(a.exitCode===0&&/^\d+\.\d+\.\d+/.test(a.stdout))return a.stdout.trim()}process.env.RUNNER_TEMP||(process.env.RUNNER_TEMP=(0,Yv.tmpdir)());function Bz(){let t=process.env.GITHUB_WORKSPACE;if(!t)return;let e=(0,A0.join)(t,"package.json");try{if(!(0,In.existsSync)(e))return;let{packageManager:a}=JSON.parse((0,In.readFileSync)(e,"utf8"));if(!a?.includes("bun@"))return;let[i,r]=a.split("bun@");return r}catch(a){let{message:i}=a;(0,Et.warning)(`Failed to read package.json: ${i}`)}}function Az(){let t=process.env.GITHUB_WORKSPACE;if(!t)return;let e=(0,A0.join)(t,".tool-versions");try{return(0,In.existsSync)(e)?(0,In.readFileSync)(e,"utf8").match(/^bun\s(?.*?)$/m)?.groups?.version:void 0}catch(a){let{message:i}=a;(0,Et.warning)(`Failed to read .tool-versions: ${i}`)}}Kv({version:(0,Et.getInput)("bun-version")||Bz()||Az()||void 0,customUrl:(0,Et.getInput)("bun-download-url")||void 0,registryUrl:(0,Et.getInput)("registry-url")||void 0,scope:(0,Et.getInput)("scope")||void 0,noCache:(0,Et.getBooleanInput)("no-cache")||!1}).then(({version:t,revision:e,cacheHit:a})=>{(0,Et.setOutput)("bun-version",t),(0,Et.setOutput)("bun-revision",e),(0,Et.setOutput)("cache-hit",a)}).catch(t=>{(0,Et.setFailed)(t)}); +`);for(let r of i){let n=r.split("=");if(n.length===2&&(n[0].trim()==="VERSION_ID"||n[0].trim()==="DISTRIB_RELEASE")){e=n[1].trim().replace(/^"/,"").replace(/"$/,"");break}}}}return e}St._getOsVersion=tz;function az(){let t="/etc/lsb-release",e="/etc/os-release",a="";return ol.existsSync(t)?a=ol.readFileSync(t).toString():ol.existsSync(e)&&(a=ol.readFileSync(e).toString()),a}St._readLinuxVersionFile=az});var zv=T(da=>{"use strict";var iz=da&&da.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[a]}})}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),rz=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nz=da&&da.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.hasOwnProperty.call(t,a)&&iz(e,t,a);return rz(e,t),e},Bv=da&&da.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(da,"__esModule",{value:!0});da.RetryHelper=void 0;var Av=nz(gt()),T0=class{constructor(e,a,i){if(e<1)throw new Error("max attempts should be greater than or equal to 1");if(this.maxAttempts=e,this.minSeconds=Math.floor(a),this.maxSeconds=Math.floor(i),this.minSeconds>this.maxSeconds)throw new Error("min seconds should be less than or equal to max seconds")}execute(e,a){return Bv(this,void 0,void 0,function*(){let i=1;for(;isetTimeout(a,e*1e3))})}};da.RetryHelper=T0});var Fv=T(re=>{"use strict";var sz=re&&re.__createBinding||(Object.create?function(t,e,a,i){i===void 0&&(i=a),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[a]}})}:function(t,e,a,i){i===void 0&&(i=a),t[i]=e[a]}),oz=re&&re.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ka=re&&re.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var a in t)a!=="default"&&Object.hasOwnProperty.call(t,a)&&sz(e,t,a);return oz(e,t),e},Pt=re&&re.__awaiter||function(t,e,a,i){function r(n){return n instanceof a?n:new a(function(s){s(n)})}return new(a||(a=Promise))(function(n,s){function o(l){try{d(i.next(l))}catch(c){s(c)}}function p(l){try{d(i.throw(l))}catch(c){s(c)}}function d(l){l.done?n(l.value):r(l.value).then(o,p)}d((i=i.apply(t,e||[])).next())})},pz=re&&re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(re,"__esModule",{value:!0});re.evaluateVersions=re.isExplicitVersion=re.findFromManifest=re.getManifestFromRepo=re.findAllVersions=re.find=re.cacheFile=re.cacheDir=re.extractZip=re.extractXar=re.extractTar=re.extract7z=re.downloadTool=re.HTTPError=void 0;var he=ka(gt()),Kt=ka(Ln()),la=ka(require("fs")),dz=ka(Iv()),no=ka(require("os")),_a=ka(require("path")),Mv=ka(Or()),li=ka(Mo()),lz=ka(require("stream")),cz=ka(require("util")),Rn=require("assert"),qv=pz(yc()),Xi=jn(),mz=zv(),ro=class extends Error{constructor(e){super(`Unexpected HTTP response: ${e}`),this.httpStatusCode=e,Object.setPrototypeOf(this,new.target.prototype)}};re.HTTPError=ro;var O0=process.platform==="win32",uz=process.platform==="darwin",fz="actions/tool-cache";function hz(t,e,a,i){return Pt(this,void 0,void 0,function*(){e=e||_a.join(Uv(),qv.default()),yield Kt.mkdirP(_a.dirname(e)),he.debug(`Downloading ${t}`),he.debug(`Destination ${e}`);let r=3,n=P0("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS",10),s=P0("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS",20);return yield new mz.RetryHelper(r,n,s).execute(()=>Pt(this,void 0,void 0,function*(){return yield gz(t,e||"",a,i)}),p=>!(p instanceof ro&&p.httpStatusCode&&p.httpStatusCode<500&&p.httpStatusCode!==408&&p.httpStatusCode!==429))})}re.downloadTool=hz;function gz(t,e,a,i){return Pt(this,void 0,void 0,function*(){if(la.existsSync(e))throw new Error(`Destination file path ${e} already exists`);let r=new Mv.HttpClient(fz,[],{allowRetries:!1});a&&(he.debug("set auth"),i===void 0&&(i={}),i.authorization=a);let n=yield r.get(t,i);if(n.message.statusCode!==200){let l=new ro(n.message.statusCode);throw he.debug(`Failed to download from "${t}". Code(${n.message.statusCode}) Message(${n.message.statusMessage})`),l}let s=cz.promisify(lz.pipeline),p=P0("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY",()=>n.message)(),d=!1;try{return yield s(p,la.createWriteStream(e)),he.debug("download complete"),d=!0,e}finally{if(!d){he.debug("download failed");try{yield Kt.rmRF(e)}catch(l){he.debug(`Failed to delete '${e}'. ${l.message}`)}}}})}function yz(t,e,a){return Pt(this,void 0,void 0,function*(){Rn.ok(O0,"extract7z() not supported on current OS"),Rn.ok(t,'parameter "file" is required'),e=yield pl(e);let i=process.cwd();if(process.chdir(e),a)try{let n=["x",he.isDebug()?"-bb1":"-bb0","-bd","-sccUTF-8",t],s={silent:!0};yield Xi.exec(`"${a}"`,n,s)}finally{process.chdir(i)}else{let r=_a.join(__dirname,"..","scripts","Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,""),n=t.replace(/'/g,"''").replace(/"|\n|\r/g,""),s=e.replace(/'/g,"''").replace(/"|\n|\r/g,""),p=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",`& '${r}' -Source '${n}' -Target '${s}'`],d={silent:!0};try{let l=yield Kt.which("powershell",!0);yield Xi.exec(`"${l}"`,p,d)}finally{process.chdir(i)}}return e})}re.extract7z=yz;function vz(t,e,a="xz"){return Pt(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'file' is required");e=yield pl(e),he.debug("Checking tar --version");let i="";yield Xi.exec("tar --version",[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:p=>i+=p.toString(),stderr:p=>i+=p.toString()}}),he.debug(i.trim());let r=i.toUpperCase().includes("GNU TAR"),n;a instanceof Array?n=a:n=[a],he.isDebug()&&!a.includes("v")&&n.push("-v");let s=e,o=t;return O0&&r&&(n.push("--force-local"),s=e.replace(/\\/g,"/"),o=t.replace(/\\/g,"/")),r&&(n.push("--warning=no-unknown-keyword"),n.push("--overwrite")),n.push("-C",s,"-f",o),yield Xi.exec("tar",n),e})}re.extractTar=vz;function xz(t,e,a=[]){return Pt(this,void 0,void 0,function*(){Rn.ok(uz,"extractXar() not supported on current OS"),Rn.ok(t,'parameter "file" is required'),e=yield pl(e);let i;a instanceof Array?i=a:i=[a],i.push("-x","-C",e,"-f",t),he.isDebug()&&i.push("-v");let r=yield Kt.which("xar",!0);return yield Xi.exec(`"${r}"`,Pz(i)),e})}re.extractXar=xz;function bz(t,e){return Pt(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'file' is required");return e=yield pl(e),O0?yield wz(t,e):yield Nz(t,e),e})}re.extractZip=bz;function wz(t,e){return Pt(this,void 0,void 0,function*(){let a=t.replace(/'/g,"''").replace(/"|\n|\r/g,""),i=e.replace(/'/g,"''").replace(/"|\n|\r/g,""),r=yield Kt.which("pwsh",!1);if(r){let s=["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ;","try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;",`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${a}', '${i}', $true) }`,`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${a}' -DestinationPath '${i}' -Force } else { throw $_ } } ;`].join(" ")];he.debug(`Using pwsh at path: ${r}`),yield Xi.exec(`"${r}"`,s)}else{let s=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ;","try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;",`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${a}' -DestinationPath '${i}' -Force }`,`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${a}', '${i}', $true) }`].join(" ")],o=yield Kt.which("powershell",!0);he.debug(`Using powershell at path: ${o}`),yield Xi.exec(`"${o}"`,s)}})}function Nz(t,e){return Pt(this,void 0,void 0,function*(){let a=yield Kt.which("unzip",!0),i=[t];he.isDebug()||i.unshift("-q"),i.unshift("-o"),yield Xi.exec(`"${a}"`,i,{cwd:e})})}function _z(t,e,a,i){return Pt(this,void 0,void 0,function*(){if(a=li.clean(a)||a,i=i||no.arch(),he.debug(`Caching tool ${e} ${a} ${i}`),he.debug(`source dir: ${t}`),!la.statSync(t).isDirectory())throw new Error("sourceDir is not a directory");let r=yield jv(e,a,i);for(let n of la.readdirSync(t)){let s=_a.join(t,n);yield Kt.cp(s,r,{recursive:!0})}return kv(e,a,i),r})}re.cacheDir=_z;function Sz(t,e,a,i,r){return Pt(this,void 0,void 0,function*(){if(i=li.clean(i)||i,r=r||no.arch(),he.debug(`Caching tool ${a} ${i} ${r}`),he.debug(`source file: ${t}`),!la.statSync(t).isFile())throw new Error("sourceFile is not a file");let n=yield jv(a,i,r),s=_a.join(n,e);return he.debug(`destination file ${s}`),yield Kt.cp(t,s),kv(a,i,r),n})}re.cacheFile=Sz;function Ez(t,e,a){if(!t)throw new Error("toolName parameter is required");if(!e)throw new Error("versionSpec parameter is required");if(a=a||no.arch(),!R0(e)){let r=Lv(t,a);e=Hv(r,e)}let i="";if(e){e=li.clean(e)||"";let r=_a.join(dl(),t,e,a);he.debug(`checking cache: ${r}`),la.existsSync(r)&&la.existsSync(`${r}.complete`)?(he.debug(`Found tool in cache ${t} ${e} ${a}`),i=r):he.debug("not found")}return i}re.find=Ez;function Lv(t,e){let a=[];e=e||no.arch();let i=_a.join(dl(),t);if(la.existsSync(i)){let r=la.readdirSync(i);for(let n of r)if(R0(n)){let s=_a.join(i,n,e||"");la.existsSync(s)&&la.existsSync(`${s}.complete`)&&a.push(n)}}return a}re.findAllVersions=Lv;function Cz(t,e,a,i="master"){return Pt(this,void 0,void 0,function*(){let r=[],n=`https://api.github.com/repos/${t}/${e}/git/trees/${i}`,s=new Mv.HttpClient("tool-cache"),o={};a&&(he.debug("set auth"),o.authorization=a);let p=yield s.getJson(n,o);if(!p.result)return r;let d="";for(let c of p.result.tree)if(c.path==="versions-manifest.json"){d=c.url;break}o.accept="application/vnd.github.VERSION.raw";let l=yield(yield s.get(d,o)).readBody();if(l){l=l.replace(/^\uFEFF/,"");try{r=JSON.parse(l)}catch{he.debug("Invalid json")}}return r})}re.getManifestFromRepo=Cz;function Tz(t,e,a,i=no.arch()){return Pt(this,void 0,void 0,function*(){return yield dz._findMatch(t,e,a,i)})}re.findFromManifest=Tz;function pl(t){return Pt(this,void 0,void 0,function*(){return t||(t=_a.join(Uv(),qv.default())),yield Kt.mkdirP(t),t})}function jv(t,e,a){return Pt(this,void 0,void 0,function*(){let i=_a.join(dl(),t,li.clean(e)||e,a||"");he.debug(`destination ${i}`);let r=`${i}.complete`;return yield Kt.rmRF(i),yield Kt.rmRF(r),yield Kt.mkdirP(i),i})}function kv(t,e,a){let r=`${_a.join(dl(),t,li.clean(e)||e,a||"")}.complete`;la.writeFileSync(r,""),he.debug("finished caching tool")}function R0(t){let e=li.clean(t)||"";he.debug(`isExplicit: ${e}`);let a=li.valid(e)!=null;return he.debug(`explicit? ${a}`),a}re.isExplicitVersion=R0;function Hv(t,e){let a="";he.debug(`evaluating ${t.length} versions`),t=t.sort((i,r)=>li.gt(i,r)?1:-1);for(let i=t.length-1;i>=0;i--){let r=t[i];if(li.satisfies(r,e)){a=r;break}}return a?he.debug(`matched: ${a}`):he.debug("match not found"),a}re.evaluateVersions=Hv;function dl(){let t=process.env.RUNNER_TOOL_CACHE||"";return Rn.ok(t,"Expected RUNNER_TOOL_CACHE to be defined"),t}function Uv(){let t=process.env.RUNNER_TEMP||"";return Rn.ok(t,"Expected RUNNER_TEMP to be defined"),t}function P0(t,e){let a=global[t];return a!==void 0?a:e}function Pz(t){return Array.from(new Set(t))}});var Yv=require("node:os"),A0=require("node:path"),In=require("node:fs"),Et=Ht(gt());var Xv=require("node:os"),Dn=require("node:path"),Ha=require("node:fs"),_r=Ht(gt()),ll=Ht(Ov()),oo=Ht(Fv()),I0=Ht(jn());var so=require("node:os"),Vv=require("node:fs"),$v=Ht(gt());function Oz(t){let{registryUrl:e,scope:a}=t,i;if(e)try{i=new URL(e)}catch{throw new Error(`Invalid registry-url: ${e}`)}let r;return a&&(r=a.startsWith("@")?a.toLocaleLowerCase():`@${a.toLocaleLowerCase()}`),i&&r?`[install.scopes]${so.EOL}'${r}' = { token = "$BUN_AUTH_TOKEN", url = "${i}"}${so.EOL}`:i&&!r?`[install]${so.EOL}registry = "${i}"${so.EOL}`:null}function Gv(t,e){let a=Oz(e);a&&((0,$v.info)(`Writing bunfig.toml to '${t}'.`),(0,Vv.appendFileSync)(t,a,{encoding:"utf8"}))}var Wv=Ht(gt());function D0(t,e,a=1e4){return t().catch(i=>{if(e<=0)throw i;return new Promise(r=>setTimeout(r,a)).then(()=>D0(t,e-1,a))})}var Kv=async t=>{let e=(0,Dn.join)(process.cwd(),"bunfig.toml");Gv(e,t);let a=Iz(t),i=Dz(t),r=(0,Dn.join)((0,Xv.homedir)(),".bun","bin");try{(0,Ha.mkdirSync)(r,{recursive:!0})}catch(c){if(c.code!=="EEXIST")throw c}(0,_r.addPath)(r);let n=c=>process.platform==="win32"?`${c}.exe`:c,s=(0,Dn.join)(r,n("bun"));try{(0,Ha.symlinkSync)(s,(0,Dn.join)(r,n("bunx")))}catch(c){if(c.code!=="EEXIST")throw c}let o,p=!1;if(i&&await(0,ll.restoreCache)([s],a)&&(o=await Qv(s),o?(p=!0,(0,_r.info)(`Using a cached version of Bun: ${o}`)):(0,_r.warning)(`Found a cached version of Bun: ${o} (but it appears to be corrupted?)`)),p||((0,_r.info)(`Downloading a new version of Bun: ${a}`),o=await D0(async()=>await Rz(a,s),3)),!o)throw new Error("Downloaded a new version of Bun, but failed to check its version? Try again.");let[d]=o.split("+");return(0,Wv.saveState)("cache",JSON.stringify({cacheEnabled:i,cacheHit:p,bunPath:s,url:a})),{version:d,revision:o,cacheHit:p}};async function Rz(t,e){let a=await(0,oo.downloadTool)(t),i=await(0,oo.extractZip)(a),r=await B0(i);try{(0,Ha.renameSync)(r,e)}catch{(0,Ha.copyFileSync)(r,e)}return await Qv(e)}function Dz(t){let{customUrl:e,version:a,noCache:i}=t;return i||e||!a||/latest|canary|action/i.test(a)?!1:(0,ll.isFeatureAvailable)()}function Iz(t){let{customUrl:e}=t;if(e)return e;let{version:a,os:i,arch:r,avx2:n,profile:s}=t,o=encodeURIComponent(a??"latest"),p=encodeURIComponent(i??process.platform),d=encodeURIComponent(r??process.arch),l=encodeURIComponent(n??!0),c=encodeURIComponent(s??!1),{href:m}=new URL(`${o}/${p}/${d}?avx2=${l}&profile=${c}`,"https://bun.sh/download/");return m}async function B0(t){for(let e of(0,Ha.readdirSync)(t,{withFileTypes:!0})){let{name:a}=e,i=(0,Dn.join)(t,a);if(e.isFile()){if(a==="bun"||a==="bun.exe")return i;if(/^bun.*\.zip/.test(a)){let r=await(0,oo.extractZip)(i);return B0(r)}}if(/^bun/.test(a)&&e.isDirectory())return B0(i)}throw new Error("Could not find executable: bun")}async function Qv(t){let e=await(0,I0.getExecOutput)(t,["--revision"],{ignoreReturnCode:!0});if(e.exitCode===0&&/^\d+\.\d+\.\d+/.test(e.stdout))return e.stdout.trim();let a=await(0,I0.getExecOutput)(t,["--version"],{ignoreReturnCode:!0});if(a.exitCode===0&&/^\d+\.\d+\.\d+/.test(a.stdout))return a.stdout.trim()}process.env.RUNNER_TEMP||(process.env.RUNNER_TEMP=(0,Yv.tmpdir)());function Bz(){let t=process.env.GITHUB_WORKSPACE;if(!t)return;let e=(0,A0.join)(t,"package.json");try{if(!(0,In.existsSync)(e))return;let{packageManager:a}=JSON.parse((0,In.readFileSync)(e,"utf8"));if(!a?.includes("bun@"))return;let[i,r]=a.split("bun@");return r}catch(a){let{message:i}=a;(0,Et.warning)(`Failed to read package.json: ${i}`)}}function Az(){let t=process.env.GITHUB_WORKSPACE;if(!t)return;let e=(0,A0.join)(t,".tool-versions");try{return(0,In.existsSync)(e)?(0,In.readFileSync)(e,"utf8").match(/^bun\s(?.*?)$/m)?.groups?.version:void 0}catch(a){let{message:i}=a;(0,Et.warning)(`Failed to read .tool-versions: ${i}`)}}Kv({version:(0,Et.getInput)("bun-version")||Bz()||Az()||void 0,customUrl:(0,Et.getInput)("bun-download-url")||void 0,registryUrl:(0,Et.getInput)("registry-url")||void 0,scope:(0,Et.getInput)("scope")||void 0,noCache:(0,Et.getBooleanInput)("no-cache")||!1}).then(({version:t,revision:e,cacheHit:a})=>{(0,Et.setOutput)("bun-version",t),(0,Et.setOutput)("bun-revision",e),(0,Et.setOutput)("cache-hit",a),process.exit(0)}).catch(t=>{(0,Et.setFailed)(t),process.exit(1)}); /*! Bundled license information: sax/lib/sax.js: diff --git a/src/index.ts b/src/index.ts index 61c0ad58..08f0a622 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,7 +71,9 @@ runAction({ setOutput("bun-version", version); setOutput("bun-revision", revision); setOutput("cache-hit", cacheHit); + process.exit(0); }) .catch((error) => { setFailed(error); + process.exit(1); }); diff --git a/src/utils.ts b/src/utils.ts index 645b6d03..1023a894 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,8 +1,14 @@ -export function retry(fn: () => Promise, retries: number): Promise { +export function retry( + fn: () => Promise, + retries: number, + timeout = 10000 +): Promise { return fn().catch((err) => { if (retries <= 0) { throw err; } - return retry(fn, retries - 1); + return new Promise((resolve) => setTimeout(resolve, timeout)).then(() => + retry(fn, retries - 1, timeout) + ); }); }