From d434aa821aa2aa6689d082cccab525bf76d74c3d Mon Sep 17 00:00:00 2001 From: Takeo Sawada Date: Mon, 4 Nov 2024 00:29:13 +0800 Subject: [PATCH] a --- dist/main.js | 2 +- src/HttpServer.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dist/main.js b/dist/main.js index 60c93af..af936b2 100644 --- a/dist/main.js +++ b/dist/main.js @@ -58,7 +58,7 @@ ${e.format(t)} Error Message: ${n.message}`)})).result)===null||t===void 0?void 0:t.value;if(!i)throw new Error("Response json body do not have ID Token field");return i})}static getIDToken(e){return jl(this,void 0,void 0,function*(){try{let t=A.getIDTokenUrl();if(e){let s=encodeURIComponent(e);t=`${t}&audience=${s}`}(0,zl.debug)(`ID token url is ${t}`);let r=yield A.getCall(t);return(0,zl.setSecret)(r),r}catch(t){throw new Error(`Error message: ${t.message}`)}})}};gs.OidcClient=kQ});var SQ=l(te=>{"use strict";var NQ=te&&te.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})};Object.defineProperty(te,"__esModule",{value:!0});te.summary=te.markdownSummary=te.SUMMARY_DOCS_URL=te.SUMMARY_ENV_VAR=void 0;var cb=require("os"),bQ=require("fs"),{access:Ib,appendFile:hb,writeFile:lb}=bQ.promises;te.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";te.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var mQ=class{constructor(){this._buffer=""}filePath(){return NQ(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[te.SUMMARY_ENV_VAR];if(!e)throw new Error(`Unable to find environment variable for $${te.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Ib(e,bQ.constants.R_OK|bQ.constants.W_OK)}catch(t){throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,t,r={}){let s=Object.entries(r).map(([i,n])=>` ${i}="${n}"`).join("");return t?`<${e}${s}>${t}`:`<${e}${s}>`}write(e){return NQ(this,void 0,void 0,function*(){let t=!!(e!=null&&e.overwrite),r=yield this.filePath();return yield(t?lb:hb)(r,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return NQ(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,t=!1){return this._buffer+=e,t?this.addEOL():this}addEOL(){return this.addRaw(cb.EOL)}addCodeBlock(e,t){let r=Object.assign({},t&&{lang:t}),s=this.wrap("pre",this.wrap("code",e),r);return this.addRaw(s).addEOL()}addList(e,t=!1){let r=t?"ol":"ul",s=e.map(n=>this.wrap("li",n)).join(""),i=this.wrap(r,s);return this.addRaw(i).addEOL()}addTable(e){let t=e.map(s=>{let i=s.map(n=>{if(typeof n=="string")return this.wrap("td",n);let{header:o,data:g,colspan:E,rowspan:Q}=n,a=o?"th":"td",B=Object.assign(Object.assign({},E&&{colspan:E}),Q&&{rowspan:Q});return this.wrap(a,g,B)}).join("");return this.wrap("tr",i)}).join(""),r=this.wrap("table",t);return this.addRaw(r).addEOL()}addDetails(e,t){let r=this.wrap("details",this.wrap("summary",e)+t);return this.addRaw(r).addEOL()}addImage(e,t,r){let{width:s,height:i}=r||{},n=Object.assign(Object.assign({},s&&{width:s}),i&&{height:i}),o=this.wrap("img",null,Object.assign({src:e,alt:t},n));return this.addRaw(o).addEOL()}addHeading(e,t){let r=`h${t}`,s=["h1","h2","h3","h4","h5","h6"].includes(r)?r:"h1",i=this.wrap(s,e);return this.addRaw(i).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,t){let r=Object.assign({},t&&{cite:t}),s=this.wrap("blockquote",e,r);return this.addRaw(s).addEOL()}addLink(e,t){let r=this.wrap("a",e,{href:t});return this.addRaw(r).addEOL()}},Au=new mQ;te.markdownSummary=Au;te.summary=Au});var eu=l(re=>{"use strict";var ub=re&&re.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),db=re&&re.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),fb=re&&re.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&ub(e,A,t);return db(e,A),e};Object.defineProperty(re,"__esModule",{value:!0});re.toPlatformPath=re.toWin32Path=re.toPosixPath=void 0;var yb=fb(require("path"));function wb(A){return A.replace(/[\\]/g,"/")}re.toPosixPath=wb;function Db(A){return A.replace(/[/]/g,"\\")}re.toWin32Path=Db;function pb(A){return A.replace(/[/\\]/g,yb.sep)}re.toPlatformPath=pb});var LQ=l(b=>{"use strict";var Rb=b&&b.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t),Object.defineProperty(A,r,{enumerable:!0,get:function(){return e[t]}})}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),kb=b&&b.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),ru=b&&b.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.hasOwnProperty.call(A,t)&&Rb(e,A,t);return kb(e,A),e},UQ=b&&b.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})},se;Object.defineProperty(b,"__esModule",{value:!0});b.getCmdPath=b.tryGetExecutablePath=b.isRooted=b.isDirectory=b.exists=b.READONLY=b.UV_FS_O_EXLOCK=b.IS_WINDOWS=b.unlink=b.symlink=b.stat=b.rmdir=b.rm=b.rename=b.readlink=b.readdir=b.open=b.mkdir=b.lstat=b.copyFile=b.chmod=void 0;var su=ru(require("fs")),io=ru(require("path"));se=su.promises,b.chmod=se.chmod,b.copyFile=se.copyFile,b.lstat=se.lstat,b.mkdir=se.mkdir,b.open=se.open,b.readdir=se.readdir,b.readlink=se.readlink,b.rename=se.rename,b.rm=se.rm,b.rmdir=se.rmdir,b.stat=se.stat,b.symlink=se.symlink,b.unlink=se.unlink;b.IS_WINDOWS=process.platform==="win32";b.UV_FS_O_EXLOCK=268435456;b.READONLY=su.constants.O_RDONLY;function Fb(A){return UQ(this,void 0,void 0,function*(){try{yield b.stat(A)}catch(e){if(e.code==="ENOENT")return!1;throw e}return!0})}b.exists=Fb;function Nb(A,e=!1){return UQ(this,void 0,void 0,function*(){return(e?yield b.stat(A):yield b.lstat(A)).isDirectory()})}b.isDirectory=Nb;function bb(A){if(A=Sb(A),!A)throw new Error('isRooted() parameter "p" cannot be empty');return b.IS_WINDOWS?A.startsWith("\\")||/^[A-Z]:/i.test(A):A.startsWith("/")}b.isRooted=bb;function mb(A,e){return UQ(this,void 0,void 0,function*(){let t;try{t=yield b.stat(A)}catch(s){s.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${A}': ${s}`)}if(t&&t.isFile()){if(b.IS_WINDOWS){let s=io.extname(A).toUpperCase();if(e.some(i=>i.toUpperCase()===s))return A}else if(tu(t))return A}let r=A;for(let s of e){A=r+s,t=void 0;try{t=yield b.stat(A)}catch(i){i.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${A}': ${i}`)}if(t&&t.isFile()){if(b.IS_WINDOWS){try{let i=io.dirname(A),n=io.basename(A).toUpperCase();for(let o of yield b.readdir(i))if(n===o.toUpperCase()){A=io.join(i,o);break}}catch(i){console.log(`Unexpected error attempting to determine the actual case of the file '${A}': ${i}`)}return A}else if(tu(t))return A}}return""})}b.tryGetExecutablePath=mb;function Sb(A){return A=A||"",b.IS_WINDOWS?(A=A.replace(/\//g,"\\"),A.replace(/\\\\+/g,"\\")):A.replace(/\/\/+/g,"/")}function tu(A){return(A.mode&1)>0||(A.mode&8)>0&&A.gid===process.getgid()||(A.mode&64)>0&&A.uid===process.getuid()}function Ub(){var A;return(A=process.env.COMSPEC)!==null&&A!==void 0?A:"cmd.exe"}b.getCmdPath=Ub});var au=l(cA=>{"use strict";var Lb=cA&&cA.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t),Object.defineProperty(A,r,{enumerable:!0,get:function(){return e[t]}})}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),Mb=cA&&cA.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),iu=cA&&cA.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.hasOwnProperty.call(A,t)&&Lb(e,A,t);return Mb(e,A),e},Tt=cA&&cA.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})};Object.defineProperty(cA,"__esModule",{value:!0});cA.findInPath=cA.which=cA.mkdirP=cA.rmRF=cA.mv=cA.cp=void 0;var Yb=require("assert"),tt=iu(require("path")),X=iu(LQ());function xb(A,e,t={}){return Tt(this,void 0,void 0,function*(){let{force:r,recursive:s,copySourceDirectory:i}=Gb(t),n=(yield X.exists(e))?yield X.stat(e):null;if(n&&n.isFile()&&!r)return;let o=n&&n.isDirectory()&&i?tt.join(e,tt.basename(A)):e;if(!(yield X.exists(A)))throw new Error(`no such file or directory: ${A}`);if((yield X.stat(A)).isDirectory())if(s)yield Eu(A,o,0,r);else throw new Error(`Failed to copy. ${A} is a directory, but tried to copy without recursive flag.`);else{if(tt.relative(A,o)==="")throw new Error(`'${o}' and '${A}' are the same file`);yield Qu(A,o,r)}})}cA.cp=xb;function Jb(A,e,t={}){return Tt(this,void 0,void 0,function*(){if(yield X.exists(e)){let r=!0;if((yield X.isDirectory(e))&&(e=tt.join(e,tt.basename(A)),r=yield X.exists(e)),r)if(t.force==null||t.force)yield nu(e);else throw new Error("Destination already exists")}yield MQ(tt.dirname(e)),yield X.rename(A,e)})}cA.mv=Jb;function nu(A){return Tt(this,void 0,void 0,function*(){if(X.IS_WINDOWS&&/[*"<>|]/.test(A))throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');try{yield X.rm(A,{force:!0,maxRetries:3,recursive:!0,retryDelay:300})}catch(e){throw new Error(`File was unable to be removed ${e}`)}})}cA.rmRF=nu;function MQ(A){return Tt(this,void 0,void 0,function*(){Yb.ok(A,"a path argument must be provided"),yield X.mkdir(A,{recursive:!0})})}cA.mkdirP=MQ;function ou(A,e){return Tt(this,void 0,void 0,function*(){if(!A)throw new Error("parameter 'tool' is required");if(e){let r=yield ou(A,!1);if(!r)throw X.IS_WINDOWS?new Error(`Unable to locate executable file: ${A}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`):new Error(`Unable to locate executable file: ${A}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);return r}let t=yield gu(A);return t&&t.length>0?t[0]:""})}cA.which=ou;function gu(A){return Tt(this,void 0,void 0,function*(){if(!A)throw new Error("parameter 'tool' is required");let e=[];if(X.IS_WINDOWS&&process.env.PATHEXT)for(let s of process.env.PATHEXT.split(tt.delimiter))s&&e.push(s);if(X.isRooted(A)){let s=yield X.tryGetExecutablePath(A,e);return s?[s]:[]}if(A.includes(tt.sep))return[];let t=[];if(process.env.PATH)for(let s of process.env.PATH.split(tt.delimiter))s&&t.push(s);let r=[];for(let s of t){let i=yield X.tryGetExecutablePath(tt.join(s,A),e);i&&r.push(i)}return r})}cA.findInPath=gu;function Gb(A){let e=A.force==null?!0:A.force,t=!!A.recursive,r=A.copySourceDirectory==null?!0:!!A.copySourceDirectory;return{force:e,recursive:t,copySourceDirectory:r}}function Eu(A,e,t,r){return Tt(this,void 0,void 0,function*(){if(t>=255)return;t++,yield MQ(e);let s=yield X.readdir(A);for(let i of s){let n=`${A}/${i}`,o=`${e}/${i}`;(yield X.lstat(n)).isDirectory()?yield Eu(n,o,t,r):yield Qu(n,o,r)}yield X.chmod(e,(yield X.stat(A)).mode)})}function Qu(A,e,t){return Tt(this,void 0,void 0,function*(){if((yield X.lstat(A)).isSymbolicLink()){try{yield X.lstat(e),yield X.unlink(e)}catch(s){s.code==="EPERM"&&(yield X.chmod(e,"0666"),yield X.unlink(e))}let r=yield X.readlink(A);yield X.symlink(r,e,X.IS_WINDOWS?"junction":null)}else(!(yield X.exists(e))||t)&&(yield X.copyFile(A,e))})}});var Iu=l(ie=>{"use strict";var Tb=ie&&ie.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t),Object.defineProperty(A,r,{enumerable:!0,get:function(){return e[t]}})}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),Hb=ie&&ie.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Es=ie&&ie.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.hasOwnProperty.call(A,t)&&Tb(e,A,t);return Hb(e,A),e},Bu=ie&&ie.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})};Object.defineProperty(ie,"__esModule",{value:!0});ie.argStringToArray=ie.ToolRunner=void 0;var no=Es(require("os")),cu=Es(require("events")),vb=Es(require("child_process")),Vb=Es(require("path")),qb=Es(au()),Cu=Es(LQ()),Ob=require("timers"),oo=process.platform==="win32",YQ=class extends cu.EventEmitter{constructor(e,t,r){if(super(),!e)throw new Error("Parameter 'toolPath' cannot be null or empty.");this.toolPath=e,this.args=t||[],this.options=r||{}}_debug(e){this.options.listeners&&this.options.listeners.debug&&this.options.listeners.debug(e)}_getCommandString(e,t){let r=this._getSpawnFileName(),s=this._getSpawnArgs(e),i=t?"":"[command]";if(oo)if(this._isCmdFile()){i+=r;for(let n of s)i+=` ${n}`}else if(e.windowsVerbatimArguments){i+=`"${r}"`;for(let n of s)i+=` ${n}`}else{i+=this._windowsQuoteCmdArg(r);for(let n of s)i+=` ${this._windowsQuoteCmdArg(n)}`}else{i+=r;for(let n of s)i+=` ${n}`}return i}_processLineBuffer(e,t,r){try{let s=t+e.toString(),i=s.indexOf(no.EOL);for(;i>-1;){let n=s.substring(0,i);r(n),s=s.substring(i+no.EOL.length),i=s.indexOf(no.EOL)}return s}catch(s){return this._debug(`error processing line. Failed with error ${s}`),""}}_getSpawnFileName(){return oo&&this._isCmdFile()?process.env.COMSPEC||"cmd.exe":this.toolPath}_getSpawnArgs(e){if(oo&&this._isCmdFile()){let t=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(let r of this.args)t+=" ",t+=e.windowsVerbatimArguments?r:this._windowsQuoteCmdArg(r);return t+='"',[t]}return this.args}_endsWith(e,t){return e.endsWith(t)}_isCmdFile(){let e=this.toolPath.toUpperCase();return this._endsWith(e,".CMD")||this._endsWith(e,".BAT")}_windowsQuoteCmdArg(e){if(!this._isCmdFile())return this._uvQuoteCmdArg(e);if(!e)return'""';let t=[" "," ","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'],r=!1;for(let n of e)if(t.some(o=>o===n)){r=!0;break}if(!r)return e;let s='"',i=!0;for(let n=e.length;n>0;n--)s+=e[n-1],i&&e[n-1]==="\\"?s+="\\":e[n-1]==='"'?(i=!0,s+='"'):i=!1;return s+='"',s.split("").reverse().join("")}_uvQuoteCmdArg(e){if(!e)return'""';if(!e.includes(" ")&&!e.includes(" ")&&!e.includes('"'))return e;if(!e.includes('"')&&!e.includes("\\"))return`"${e}"`;let t='"',r=!0;for(let s=e.length;s>0;s--)t+=e[s-1],r&&e[s-1]==="\\"?t+="\\":e[s-1]==='"'?(r=!0,t+="\\"):r=!1;return t+='"',t.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};let t={cwd:e.cwd||process.cwd(),env:e.env||process.env,silent:e.silent||!1,windowsVerbatimArguments:e.windowsVerbatimArguments||!1,failOnStdErr:e.failOnStdErr||!1,ignoreReturnCode:e.ignoreReturnCode||!1,delay:e.delay||1e4};return t.outStream=e.outStream||process.stdout,t.errStream=e.errStream||process.stderr,t}_getSpawnOptions(e,t){e=e||{};let r={};return r.cwd=e.cwd,r.env=e.env,r.windowsVerbatimArguments=e.windowsVerbatimArguments||this._isCmdFile(),e.windowsVerbatimArguments&&(r.argv0=`"${t}"`),r}exec(){return Bu(this,void 0,void 0,function*(){return!Cu.isRooted(this.toolPath)&&(this.toolPath.includes("/")||oo&&this.toolPath.includes("\\"))&&(this.toolPath=Vb.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)),this.toolPath=yield qb.which(this.toolPath,!0),new Promise((e,t)=>Bu(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`),this._debug("arguments:");for(let E of this.args)this._debug(` ${E}`);let r=this._cloneExecOptions(this.options);!r.silent&&r.outStream&&r.outStream.write(this._getCommandString(r)+no.EOL);let s=new xQ(r,this.toolPath);if(s.on("debug",E=>{this._debug(E)}),this.options.cwd&&!(yield Cu.exists(this.options.cwd)))return t(new Error(`The cwd: ${this.options.cwd} does not exist!`));let i=this._getSpawnFileName(),n=vb.spawn(i,this._getSpawnArgs(r),this._getSpawnOptions(this.options,i)),o="";n.stdout&&n.stdout.on("data",E=>{this.options.listeners&&this.options.listeners.stdout&&this.options.listeners.stdout(E),!r.silent&&r.outStream&&r.outStream.write(E),o=this._processLineBuffer(E,o,Q=>{this.options.listeners&&this.options.listeners.stdline&&this.options.listeners.stdline(Q)})});let g="";if(n.stderr&&n.stderr.on("data",E=>{s.processStderr=!0,this.options.listeners&&this.options.listeners.stderr&&this.options.listeners.stderr(E),!r.silent&&r.errStream&&r.outStream&&(r.failOnStdErr?r.errStream:r.outStream).write(E),g=this._processLineBuffer(E,g,Q=>{this.options.listeners&&this.options.listeners.errline&&this.options.listeners.errline(Q)})}),n.on("error",E=>{s.processError=E.message,s.processExited=!0,s.processClosed=!0,s.CheckComplete()}),n.on("exit",E=>{s.processExitCode=E,s.processExited=!0,this._debug(`Exit code ${E} received from tool '${this.toolPath}'`),s.CheckComplete()}),n.on("close",E=>{s.processExitCode=E,s.processExited=!0,s.processClosed=!0,this._debug(`STDIO streams have closed for tool '${this.toolPath}'`),s.CheckComplete()}),s.on("done",(E,Q)=>{o.length>0&&this.emit("stdline",o),g.length>0&&this.emit("errline",g),n.removeAllListeners(),E?t(E):e(Q)}),this.options.input){if(!n.stdin)throw new Error("child process missing stdin");n.stdin.end(this.options.input)}}))})}};ie.ToolRunner=YQ;function Wb(A){let e=[],t=!1,r=!1,s="";function i(n){r&&n!=='"'&&(s+="\\"),s+=n,r=!1}for(let n=0;n0&&(e.push(s),s="");continue}i(o)}return s.length>0&&e.push(s.trim()),e}ie.argStringToArray=Wb;var xQ=class A extends cu.EventEmitter{constructor(e,t){if(super(),this.processClosed=!1,this.processError="",this.processExitCode=0,this.processExited=!1,this.processStderr=!1,this.delay=1e4,this.done=!1,this.timeout=null,!t)throw new Error("toolPath must not be empty");this.options=e,this.toolPath=t,e.delay&&(this.delay=e.delay)}CheckComplete(){this.done||(this.processClosed?this._setResult():this.processExited&&(this.timeout=Ob.setTimeout(A.HandleTimeout,this.delay,this)))}_debug(e){this.emit("debug",e)}_setResult(){let e;this.processExited&&(this.processError?e=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`):this.processExitCode!==0&&!this.options.ignoreReturnCode?e=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`):this.processStderr&&this.options.failOnStdErr&&(e=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`))),this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.done=!0,this.emit("done",e,this.processExitCode)}static HandleTimeout(e){if(!e.done){if(!e.processClosed&&e.processExited){let t=`The STDIO streams did not close within ${e.delay/1e3} seconds of the exit event from process '${e.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;e._debug(t)}e._setResult()}}}});var fu=l(ne=>{"use strict";var Pb=ne&&ne.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t),Object.defineProperty(A,r,{enumerable:!0,get:function(){return e[t]}})}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),_b=ne&&ne.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Zb=ne&&ne.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.hasOwnProperty.call(A,t)&&Pb(e,A,t);return _b(e,A),e},uu=ne&&ne.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})};Object.defineProperty(ne,"__esModule",{value:!0});ne.getExecOutput=ne.exec=void 0;var hu=require("string_decoder"),lu=Zb(Iu());function du(A,e,t){return uu(this,void 0,void 0,function*(){let r=lu.argStringToArray(A);if(r.length===0)throw new Error("Parameter 'commandLine' cannot be null or empty.");let s=r[0];return e=r.slice(1).concat(e||[]),new lu.ToolRunner(s,e,t).exec()})}ne.exec=du;function Xb(A,e,t){var r,s;return uu(this,void 0,void 0,function*(){let i="",n="",o=new hu.StringDecoder("utf8"),g=new hu.StringDecoder("utf8"),E=(r=t==null?void 0:t.listeners)===null||r===void 0?void 0:r.stdout,Q=(s=t==null?void 0:t.listeners)===null||s===void 0?void 0:s.stderr,a=h=>{n+=g.write(h),Q&&Q(h)},B=h=>{i+=o.write(h),E&&E(h)},C=Object.assign(Object.assign({},t==null?void 0:t.listeners),{stdout:B,stderr:a}),c=yield du(A,e,Object.assign(Object.assign({},t),{listeners:C}));return i+=o.end(),n+=g.end(),{exitCode:c,stdout:i,stderr:n}})}ne.getExecOutput=Xb});var wu=l(W=>{"use strict";var Kb=W&&W.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),jb=W&&W.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),zb=W&&W.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&Kb(e,A,t);return jb(e,A),e},Eo=W&&W.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})},$b=W&&W.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(W,"__esModule",{value:!0});W.getDetails=W.isLinux=W.isMacOS=W.isWindows=W.arch=W.platform=void 0;var yu=$b(require("os")),go=zb(fu()),Am=()=>Eo(void 0,void 0,void 0,function*(){let{stdout:A}=yield go.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"',void 0,{silent:!0}),{stdout:e}=yield go.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"',void 0,{silent:!0});return{name:e.trim(),version:A.trim()}}),em=()=>Eo(void 0,void 0,void 0,function*(){var A,e,t,r;let{stdout:s}=yield go.getExecOutput("sw_vers",void 0,{silent:!0}),i=(e=(A=s.match(/ProductVersion:\s*(.+)/))===null||A===void 0?void 0:A[1])!==null&&e!==void 0?e:"";return{name:(r=(t=s.match(/ProductName:\s*(.+)/))===null||t===void 0?void 0:t[1])!==null&&r!==void 0?r:"",version:i}}),tm=()=>Eo(void 0,void 0,void 0,function*(){let{stdout:A}=yield go.getExecOutput("lsb_release",["-i","-r","-s"],{silent:!0}),[e,t]=A.trim().split(` `);return{name:e,version:t}});W.platform=yu.default.platform();W.arch=yu.default.arch();W.isWindows=W.platform==="win32";W.isMacOS=W.platform==="darwin";W.isLinux=W.platform==="linux";function rm(){return Eo(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield W.isWindows?Am():W.isMacOS?em():tm()),{platform:W.platform,arch:W.arch,isWindows:W.isWindows,isMacOS:W.isMacOS,isLinux:W.isLinux})})}W.getDetails=rm});var FQ=l(F=>{"use strict";var sm=F&&F.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),im=F&&F.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),GQ=F&&F.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&sm(e,A,t);return im(e,A),e},Du=F&&F.__awaiter||function(A,e,t,r){function s(i){return i instanceof t?i:new t(function(n){n(i)})}return new(t||(t=Promise))(function(i,n){function o(Q){try{E(r.next(Q))}catch(a){n(a)}}function g(Q){try{E(r.throw(Q))}catch(a){n(a)}}function E(Q){Q.done?i(Q.value):s(Q.value).then(o,g)}E((r=r.apply(A,e||[])).next())})};Object.defineProperty(F,"__esModule",{value:!0});F.platform=F.toPlatformPath=F.toWin32Path=F.toPosixPath=F.markdownSummary=F.summary=F.getIDToken=F.getState=F.saveState=F.group=F.endGroup=F.startGroup=F.info=F.notice=F.warning=F.error=F.debug=F.isDebug=F.setFailed=F.setCommandEcho=F.setOutput=F.getBooleanInput=F.getMultilineInput=F.getInput=F.addPath=F.setSecret=F.exportVariable=F.ExitCode=void 0;var Se=KQ(),Qr=$Q(),Qs=ni(),pu=GQ(require("os")),nm=GQ(require("path")),om=$l(),JQ;(function(A){A[A.Success=0]="Success",A[A.Failure=1]="Failure"})(JQ||(F.ExitCode=JQ={}));function gm(A,e){let t=(0,Qs.toCommandValue)(e);if(process.env[A]=t,process.env.GITHUB_ENV||"")return(0,Qr.issueFileCommand)("ENV",(0,Qr.prepareKeyValueMessage)(A,e));(0,Se.issueCommand)("set-env",{name:A},t)}F.exportVariable=gm;function Em(A){(0,Se.issueCommand)("add-mask",{},A)}F.setSecret=Em;function Qm(A){process.env.GITHUB_PATH||""?(0,Qr.issueFileCommand)("PATH",A):(0,Se.issueCommand)("add-path",{},A),process.env.PATH=`${A}${nm.delimiter}${process.env.PATH}`}F.addPath=Qm;function TQ(A,e){let t=process.env[`INPUT_${A.replace(/ /g,"_").toUpperCase()}`]||"";if(e&&e.required&&!t)throw new Error(`Input required and not supplied: ${A}`);return e&&e.trimWhitespace===!1?t:t.trim()}F.getInput=TQ;function am(A,e){let t=TQ(A,e).split(` `).filter(r=>r!=="");return e&&e.trimWhitespace===!1?t:t.map(r=>r.trim())}F.getMultilineInput=am;function Bm(A,e){let t=["true","True","TRUE"],r=["false","False","FALSE"],s=TQ(A,e);if(t.includes(s))return!0;if(r.includes(s))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${A} -Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}F.getBooleanInput=Bm;function Cm(A,e){if(process.env.GITHUB_OUTPUT||"")return(0,Qr.issueFileCommand)("OUTPUT",(0,Qr.prepareKeyValueMessage)(A,e));process.stdout.write(pu.EOL),(0,Se.issueCommand)("set-output",{name:A},(0,Qs.toCommandValue)(e))}F.setOutput=Cm;function cm(A){(0,Se.issue)("echo",A?"on":"off")}F.setCommandEcho=cm;function Im(A){process.exitCode=JQ.Failure,Ru(A)}F.setFailed=Im;function hm(){return process.env.RUNNER_DEBUG==="1"}F.isDebug=hm;function lm(A){(0,Se.issueCommand)("debug",{},A)}F.debug=lm;function Ru(A,e={}){(0,Se.issueCommand)("error",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.error=Ru;function um(A,e={}){(0,Se.issueCommand)("warning",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.warning=um;function dm(A,e={}){(0,Se.issueCommand)("notice",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.notice=dm;function fm(A){process.stdout.write(A+pu.EOL)}F.info=fm;function ku(A){(0,Se.issue)("group",A)}F.startGroup=ku;function Fu(){(0,Se.issue)("endgroup")}F.endGroup=Fu;function ym(A,e){return Du(this,void 0,void 0,function*(){ku(A);let t;try{t=yield e()}finally{Fu()}return t})}F.group=ym;function wm(A,e){if(process.env.GITHUB_STATE||"")return(0,Qr.issueFileCommand)("STATE",(0,Qr.prepareKeyValueMessage)(A,e));(0,Se.issueCommand)("save-state",{name:A},(0,Qs.toCommandValue)(e))}F.saveState=wm;function Dm(A){return process.env[`STATE_${A}`]||""}F.getState=Dm;function pm(A){return Du(this,void 0,void 0,function*(){return yield om.OidcClient.getIDToken(A)})}F.getIDToken=pm;var Rm=SQ();Object.defineProperty(F,"summary",{enumerable:!0,get:function(){return Rm.summary}});var km=SQ();Object.defineProperty(F,"markdownSummary",{enumerable:!0,get:function(){return km.markdownSummary}});var HQ=eu();Object.defineProperty(F,"toPosixPath",{enumerable:!0,get:function(){return HQ.toPosixPath}});Object.defineProperty(F,"toWin32Path",{enumerable:!0,get:function(){return HQ.toWin32Path}});Object.defineProperty(F,"toPlatformPath",{enumerable:!0,get:function(){return HQ.toPlatformPath}});F.platform=GQ(wu())});var Nu=l(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.ActionsCache=void 0;var Fm=so(),Nm=RQ();function vQ(A){return A?200<=A&&A<300:!1}var VQ=class{constructor(e,t,r){TA(this,"baseUrl");TA(this,"token");TA(this,"version");TA(this,"httpClient");this.baseUrl=e,this.token=t,this.version=r,this.httpClient=new Fm.HttpClient("bazel-github-actions-cache",[new Nm.BearerCredentialHandler(t)],{headers:{Accept:"application/json;api-version=6.0-preview.1"}})}reserve(e,t,r){return d(this,null,function*(){var n;let s=`${e}-${t}`;return(n=(yield this.httpClient.postJson(`${this.baseUrl}caches`,{key:s,version:this.version,cacheSize:r})).result)==null?void 0:n.cacheId})}upload(e,t,r){return d(this,null,function*(){let s=yield this.httpClient.sendStream("PATCH",`${this.baseUrl}caches/${e}`,r,{"Content-Type":"application/octet-stream","Content-Range":`bytes 0-${t-1}/*`});return s.message.resume(),vQ(s.message.statusCode)})}commit(e,t){return d(this,null,function*(){let r=yield this.httpClient.postJson(`${this.baseUrl}caches/${e}`,{size:t});return!!vQ(r.statusCode)})}exists(e,t){return d(this,null,function*(){let r=`${e}-${t}`,s=yield this.httpClient.head(`${this.baseUrl}cache?keys=${r}&version=${this.version}`);return s.message.resume(),vQ(s.message.statusCode)})}getLocation(e,t){return d(this,null,function*(){var i;let r=`${e}-${t}`,s=yield this.httpClient.getJson(`${this.baseUrl}cache?keys=${r}&version=${this.version}`);return(i=s==null?void 0:s.result)==null?void 0:i.archiveLocation})}};Qo.ActionsCache=VQ});var Su=l(rt=>{"use strict";var bm=rt&&rt.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),mm=rt&&rt.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Sm=rt&&rt.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&bm(e,A,t);return mm(e,A),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.HttpServer=void 0;var Um=Sm(require("http")),bu=require("url"),mu=so(),qQ=class extends Um.Server{constructor(t){super();TA(this,"n_get",0);TA(this,"n_get_hit",0);TA(this,"n_put",0);TA(this,"n_put_succ",0);TA(this,"n_put_bytes",0);TA(this,"actionsCache");TA(this,"httpClient");this.actionsCache=t,this.httpClient=new mu.HttpClient("bazel-github-actions-cache"),this.on("request",this.onRequest)}getStats(){return{n_get:this.n_get,n_get_hit:this.n_get_hit,n_put:this.n_put,n_put_succ:this.n_put_succ,n_put_bytes:this.n_put_bytes}}get_close(t,r){t.resume(),this.close(),r.writeHead(200,{"Content-type":"application/json"}),r.end(JSON.stringify(this.getStats()))}handle_error(t,r){t instanceof mu.HttpClientError?(r.writeHead(t.statusCode,t.message),r.write(t.result)):t instanceof Error?(r.writeHead(500,"Internal Server Error"),r.write(t)):r.writeHead(500,"Internal Server Error"),r.end()}get_cache(t,r,s){return d(this,null,function*(){this.n_get+=1;try{let i=yield this.actionsCache.getLocation(t,r);if(!i){s.writeHead(404),s.end();return}let n=yield this.httpClient.get(i);if(n.message.statusCode!=200){s.writeHead(n.message.statusCode||500),s.end();return}this.n_get_hit+=1,s.writeHead(200,{"Content-Type":"application/octet-stream"}),n.message.pipe(s)}catch(i){this.handle_error(i,s);return}})}put_cache(t,r,s,i,n){return d(this,null,function*(){this.n_put+=1;try{if(yield this.actionsCache.exists(t,r)){n.writeHead(200),n.end();return}let o=yield this.actionsCache.reserve(t,r,s);if(!o){n.writeHead(500),n.end();return}if(!(yield this.actionsCache.upload(o,s,i))){n.writeHead(500),n.end();return}this.n_put_succ+=1,this.n_put_bytes+=s}catch(o){this.handle_error(o,n);return}n.writeHead(200),n.end()})}cache(t,r){return d(this,null,function*(){var g,E,Q,a,B;let s=(0,bu.parse)((g=t.url)!=null?g:""),i=(Q=(E=s.pathname)==null?void 0:E.startsWith("/cas/"))!=null?Q:!1,n=(B=(a=s.pathname)==null?void 0:a.substring(i?5:4))!=null?B:"",o=i?"cas":"ac";if(t.method=="PUT"){let C=Number(t.headers["content-length"]);yield this.put_cache(o,n,C,t,r)}else t.method=="GET"?(t.resume(),yield this.get_cache(o,n,r)):(t.resume(),r.writeHead(405,"Method Not Allowed"),r.end())})}onRequest(t,r){return d(this,null,function*(){var i,n,o;let s=(0,bu.parse)((i=t.url)!=null?i:"");s.pathname=="/close"?this.get_close(t,r):(n=s.pathname)!=null&&n.startsWith("/cas/")||(o=s.pathname)!=null&&o.startsWith("/ac/")?this.cache(t,r):(t.resume(),r.writeHead(404,"Not Found"),r.end())})}};rt.HttpServer=qQ});var Lm=exports&&exports.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),Mm=exports&&exports.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Ym=exports&&exports.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&Lm(e,A,t);return Mm(e,A),e};Object.defineProperty(exports,"__esModule",{value:!0});var xm=require("child_process"),Jm=Ym(FQ()),Gm=Nu(),Tm=Su(),Hm=[];function vm(A){Jm.debug(A),Hm.push(A)}process.env.IS_BACKGROUND?Vm():(console.log("spawning"),vm("foreground"),(0,xm.spawn)(process.execPath,process.argv.slice(1),{detached:!0,stdio:"inherit",env:x(y({},process.env),{IS_BACKGROUND:"1"})}).unref());function Vm(){var n,o;let e=`${process.env.ACTIONS_CACHE_URL||"http://localhost:3056/"}_apis/artifactcache/`,t=(n=process.env.ACTIONS_RUNTIME_TOKEN)!=null?n:"",r=(o=process.env.INPUT_VERSION)!=null?o:"7562522d0ae9a33373e8d759b6d20a810f959412ae8f80278a433f2f7eb2de78",s=new Gm.ActionsCache(e,t,r),i=new Tm.HttpServer(s);i.on("close",()=>{console.log("Goodbye: "+JSON.stringify(i.getStats()))}),i.listen(3055)} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}F.getBooleanInput=Bm;function Cm(A,e){if(process.env.GITHUB_OUTPUT||"")return(0,Qr.issueFileCommand)("OUTPUT",(0,Qr.prepareKeyValueMessage)(A,e));process.stdout.write(pu.EOL),(0,Se.issueCommand)("set-output",{name:A},(0,Qs.toCommandValue)(e))}F.setOutput=Cm;function cm(A){(0,Se.issue)("echo",A?"on":"off")}F.setCommandEcho=cm;function Im(A){process.exitCode=JQ.Failure,Ru(A)}F.setFailed=Im;function hm(){return process.env.RUNNER_DEBUG==="1"}F.isDebug=hm;function lm(A){(0,Se.issueCommand)("debug",{},A)}F.debug=lm;function Ru(A,e={}){(0,Se.issueCommand)("error",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.error=Ru;function um(A,e={}){(0,Se.issueCommand)("warning",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.warning=um;function dm(A,e={}){(0,Se.issueCommand)("notice",(0,Qs.toCommandProperties)(e),A instanceof Error?A.toString():A)}F.notice=dm;function fm(A){process.stdout.write(A+pu.EOL)}F.info=fm;function ku(A){(0,Se.issue)("group",A)}F.startGroup=ku;function Fu(){(0,Se.issue)("endgroup")}F.endGroup=Fu;function ym(A,e){return Du(this,void 0,void 0,function*(){ku(A);let t;try{t=yield e()}finally{Fu()}return t})}F.group=ym;function wm(A,e){if(process.env.GITHUB_STATE||"")return(0,Qr.issueFileCommand)("STATE",(0,Qr.prepareKeyValueMessage)(A,e));(0,Se.issueCommand)("save-state",{name:A},(0,Qs.toCommandValue)(e))}F.saveState=wm;function Dm(A){return process.env[`STATE_${A}`]||""}F.getState=Dm;function pm(A){return Du(this,void 0,void 0,function*(){return yield om.OidcClient.getIDToken(A)})}F.getIDToken=pm;var Rm=SQ();Object.defineProperty(F,"summary",{enumerable:!0,get:function(){return Rm.summary}});var km=SQ();Object.defineProperty(F,"markdownSummary",{enumerable:!0,get:function(){return km.markdownSummary}});var HQ=eu();Object.defineProperty(F,"toPosixPath",{enumerable:!0,get:function(){return HQ.toPosixPath}});Object.defineProperty(F,"toWin32Path",{enumerable:!0,get:function(){return HQ.toWin32Path}});Object.defineProperty(F,"toPlatformPath",{enumerable:!0,get:function(){return HQ.toPlatformPath}});F.platform=GQ(wu())});var Nu=l(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.ActionsCache=void 0;var Fm=so(),Nm=RQ();function vQ(A){return A?200<=A&&A<300:!1}var VQ=class{constructor(e,t,r){TA(this,"baseUrl");TA(this,"token");TA(this,"version");TA(this,"httpClient");this.baseUrl=e,this.token=t,this.version=r,this.httpClient=new Fm.HttpClient("bazel-github-actions-cache",[new Nm.BearerCredentialHandler(t)],{headers:{Accept:"application/json;api-version=6.0-preview.1"}})}reserve(e,t,r){return d(this,null,function*(){var n;let s=`${e}-${t}`;return(n=(yield this.httpClient.postJson(`${this.baseUrl}caches`,{key:s,version:this.version,cacheSize:r})).result)==null?void 0:n.cacheId})}upload(e,t,r){return d(this,null,function*(){let s=yield this.httpClient.sendStream("PATCH",`${this.baseUrl}caches/${e}`,r,{"Content-Type":"application/octet-stream","Content-Range":`bytes 0-${t-1}/*`});return s.message.resume(),vQ(s.message.statusCode)})}commit(e,t){return d(this,null,function*(){let r=yield this.httpClient.postJson(`${this.baseUrl}caches/${e}`,{size:t});return!!vQ(r.statusCode)})}exists(e,t){return d(this,null,function*(){let r=`${e}-${t}`,s=yield this.httpClient.head(`${this.baseUrl}cache?keys=${r}&version=${this.version}`);return s.message.resume(),vQ(s.message.statusCode)})}getLocation(e,t){return d(this,null,function*(){var i;let r=`${e}-${t}`,s=yield this.httpClient.getJson(`${this.baseUrl}cache?keys=${r}&version=${this.version}`);return(i=s==null?void 0:s.result)==null?void 0:i.archiveLocation})}};Qo.ActionsCache=VQ});var Su=l(rt=>{"use strict";var bm=rt&&rt.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),mm=rt&&rt.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Sm=rt&&rt.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&bm(e,A,t);return mm(e,A),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.HttpServer=void 0;var Um=Sm(require("http")),bu=require("url"),mu=so(),qQ=class extends Um.Server{constructor(t){super();TA(this,"n_get",0);TA(this,"n_get_hit",0);TA(this,"n_put",0);TA(this,"n_put_succ",0);TA(this,"n_put_bytes",0);TA(this,"actionsCache");TA(this,"httpClient");this.actionsCache=t,this.httpClient=new mu.HttpClient("bazel-github-actions-cache"),this.on("request",this.onRequest)}getStats(){return{n_get:this.n_get,n_get_hit:this.n_get_hit,n_put:this.n_put,n_put_succ:this.n_put_succ,n_put_bytes:this.n_put_bytes}}get_close(t,r){this.close(),r.writeHead(200,{"Content-type":"application/json"}),r.end(JSON.stringify(this.getStats()))}handle_error(t,r){t instanceof mu.HttpClientError?(r.writeHead(t.statusCode,t.message),r.write(t.result)):t instanceof Error?(r.writeHead(500,"Internal Server Error"),r.write(t)):r.writeHead(500,"Internal Server Error"),r.end()}get_cache(t,r,s){return d(this,null,function*(){this.n_get+=1;try{let i=yield this.actionsCache.getLocation(t,r);if(!i){s.writeHead(404),s.end();return}let n=yield this.httpClient.get(i);if(n.message.statusCode!=200){s.writeHead(n.message.statusCode||500),s.end();return}this.n_get_hit+=1,s.writeHead(200,{"Content-Type":"application/octet-stream"}),n.message.pipe(s)}catch(i){this.handle_error(i,s);return}})}put_cache(t,r,s,i,n){return d(this,null,function*(){this.n_put+=1;try{if(yield this.actionsCache.exists(t,r)){n.writeHead(200),n.end();return}let o=yield this.actionsCache.reserve(t,r,s);if(!o){i.resume(),n.writeHead(500),n.end();return}if(!(yield this.actionsCache.upload(o,s,i))){i.resume(),n.writeHead(500),n.end();return}this.n_put_succ+=1,this.n_put_bytes+=s}catch(o){this.handle_error(o,n);return}n.writeHead(200),n.end()})}cache(t,r){return d(this,null,function*(){var g,E,Q,a,B;let s=(0,bu.parse)((g=t.url)!=null?g:""),i=(Q=(E=s.pathname)==null?void 0:E.startsWith("/cas/"))!=null?Q:!1,n=(B=(a=s.pathname)==null?void 0:a.substring(i?5:4))!=null?B:"",o=i?"cas":"ac";if(t.method=="PUT"){let C=Number(t.headers["content-length"]);yield this.put_cache(o,n,C,t,r)}else t.method=="GET"?yield this.get_cache(o,n,r):(r.writeHead(405,"Method Not Allowed"),r.end())})}onRequest(t,r){return d(this,null,function*(){var i,n,o;let s=(0,bu.parse)((i=t.url)!=null?i:"");s.pathname=="/close"?this.get_close(t,r):(n=s.pathname)!=null&&n.startsWith("/cas/")||(o=s.pathname)!=null&&o.startsWith("/ac/")?this.cache(t,r):(r.writeHead(404,"Not Found"),r.end())})}};rt.HttpServer=qQ});var Lm=exports&&exports.__createBinding||(Object.create?function(A,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(A,r,s)}:function(A,e,t,r){r===void 0&&(r=t),A[r]=e[t]}),Mm=exports&&exports.__setModuleDefault||(Object.create?function(A,e){Object.defineProperty(A,"default",{enumerable:!0,value:e})}:function(A,e){A.default=e}),Ym=exports&&exports.__importStar||function(A){if(A&&A.__esModule)return A;var e={};if(A!=null)for(var t in A)t!=="default"&&Object.prototype.hasOwnProperty.call(A,t)&&Lm(e,A,t);return Mm(e,A),e};Object.defineProperty(exports,"__esModule",{value:!0});var xm=require("child_process"),Jm=Ym(FQ()),Gm=Nu(),Tm=Su(),Hm=[];function vm(A){Jm.debug(A),Hm.push(A)}process.env.IS_BACKGROUND?Vm():(console.log("spawning"),vm("foreground"),(0,xm.spawn)(process.execPath,process.argv.slice(1),{detached:!0,stdio:"inherit",env:x(y({},process.env),{IS_BACKGROUND:"1"})}).unref());function Vm(){var n,o;let e=`${process.env.ACTIONS_CACHE_URL||"http://localhost:3056/"}_apis/artifactcache/`,t=(n=process.env.ACTIONS_RUNTIME_TOKEN)!=null?n:"",r=(o=process.env.INPUT_VERSION)!=null?o:"7562522d0ae9a33373e8d759b6d20a810f959412ae8f80278a433f2f7eb2de78",s=new Gm.ActionsCache(e,t,r),i=new Tm.HttpServer(s);i.on("close",()=>{console.log("Goodbye: "+JSON.stringify(i.getStats()))}),i.listen(3055)} /*! Bundled license information: undici/lib/fetch/body.js: diff --git a/src/HttpServer.ts b/src/HttpServer.ts index 72fbe6d..4a81965 100644 --- a/src/HttpServer.ts +++ b/src/HttpServer.ts @@ -30,7 +30,6 @@ export class HttpServer extends http.Server { } get_close(request: http.IncomingMessage, response: http.ServerResponse) { - request.resume() this.close() response.writeHead(200, { "Content-type": "application/json" @@ -87,11 +86,13 @@ export class HttpServer extends http.Server { } const cacheId = await this.actionsCache.reserve(type, hash, size) if (!cacheId) { + stream.resume() response.writeHead(500) response.end() return } if (!await this.actionsCache.upload(cacheId, size, stream)) { + stream.resume() response.writeHead(500) response.end() return @@ -115,10 +116,8 @@ export class HttpServer extends http.Server { const size = Number(request.headers['content-length']) await this.put_cache(type, hash, size, request, response) } else if (request.method == 'GET') { - request.resume() await this.get_cache(type, hash, response) } else { - request.resume() response.writeHead(405, "Method Not Allowed") response.end() } @@ -131,7 +130,6 @@ export class HttpServer extends http.Server { } else if (url.pathname?.startsWith('/cas/') || url.pathname?.startsWith('/ac/')) { this.cache(request, response) } else { - request.resume() response.writeHead(404, "Not Found"); response.end(); }