attic-action/dist/index.js

9 lines
79 KiB
JavaScript
Raw Permalink Normal View History

2024-09-01 14:41:09 +00:00
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __esm=(fn,res)=>function(){return fn&&(res=(0,fn[__getOwnPropNames(fn)[0]])(fn=0)),res};var __commonJS=(cb,mod)=>function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports};var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var require_utils=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/utils.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.toCommandProperties=exports.toCommandValue=void 0;function toCommandValue(input){return input==null?"":typeof input=="string"||input instanceof String?input:JSON.stringify(input)}exports.toCommandValue=toCommandValue;function toCommandProperties(annotationProperties){return Object.keys(annotationProperties).length?{title:annotationProperties.title,file:annotationProperties.file,line:annotationProperties.startLine,endLine:annotationProperties.endLine,col:annotationProperties.startColumn,endColumn:annotationProperties.endColumn}:{}}exports.toCommandProperties=toCommandProperties}});var require_command=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/command.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result};Object.defineProperty(exports,"__esModule",{value:!0});exports.issue=exports.issueCommand=void 0;var os=__importStar(require("os")),utils_1=require_utils();function issueCommand(command,properties,message){let cmd=new Command(command,properties,message);process.stdout.write(cmd.toString()+os.EOL)}exports.issueCommand=issueCommand;function issue(name,message=""){issueCommand(name,{},message)}exports.issue=issue;var CMD_STRING="::",Command=class{constructor(command,properties,message){command||(command="missing.command"),this.command=command,this.properties=properties,this.message=message}toString(){let cmdStr=CMD_STRING+this.command;if(this.properties&&Object.keys(this.properties).length>0){cmdStr+=" ";let first=!0;for(let key in this.properties)if(this.properties.hasOwnProperty(key)){let val=this.properties[key];val&&(first?first=!1:cmdStr+=",",cmdStr+=`${key}=${escapeProperty(val)}`)}}return cmdStr+=`${CMD_STRING}${escapeData(this.message)}`,cmdStr}};function escapeData(s){return utils_1.toCommandValue(s).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(s){return utils_1.toCommandValue(s).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}}});function rng(){return poolPtr>rnds8Pool.length-16&&(import_crypto.default.randomFillSync(rnds8Pool),poolPtr=0),rnds8
`,cause.message,cause.stack);var error=new Error("tunneling socket could not be established, cause="+cause.message);error.code="ECONNRESET",options.request.emit("error",error),self.removeSocket(placeholder)}};TunnelingAgent.prototype.removeSocket=function(socket){var pos=this.sockets.indexOf(socket);if(pos!==-1){this.sockets.splice(pos,1);var pending=this.requests.shift();pending&&this.createSocket(pending,function(socket2){pending.request.onSocket(socket2)})}};function createSecureSocket(options,cb){var self=this;TunnelingAgent.prototype.createSocket.call(self,options,function(socket){var hostHeader=options.request.getHeader("host"),tlsOptions=mergeOptions({},self.options,{socket,servername:hostHeader?hostHeader.replace(/:.*$/,""):options.host}),secureSocket=tls.connect(0,tlsOptions);self.sockets[self.sockets.indexOf(socket)]=secureSocket,cb(secureSocket)})}function toOptions(host,port,localAddress){return typeof host=="string"?{host,port,localAddress}:host}function mergeOptions(target){for(var i=1,len=arguments.length;i<len;++i){var overrides=arguments[i];if(typeof overrides=="object")for(var keys=Object.keys(overrides),j=0,keyLen=keys.length;j<keyLen;++j){var k=keys[j];overrides[k]!==void 0&&(target[k]=overrides[k])}}return target}var debug;process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?debug=function(){var args=Array.prototype.slice.call(arguments);typeof args[0]=="string"?args[0]="TUNNEL: "+args[0]:args.unshift("TUNNEL:"),console.error.apply(console,args)}:debug=function(){};exports.debug=debug}});var require_tunnel2=__commonJS({"node_modules/.pnpm/tunnel@0.0.6/node_modules/tunnel/index.js"(exports,module2){module2.exports=require_tunnel()}});var require_lib=__commonJS({"node_modules/.pnpm/@actions+http-client@2.1.0/node_modules/@actions/http-client/lib/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.HttpClient=exports.isHttps=exports.HttpClientResponse=exports.HttpClientError=exports.getProxyUrl=exports.MediaTypes=exports.Headers=exports.HttpCodes=void 0;var http=__importStar(require("http")),https=__importStar(require("https")),pm=__importStar(require_proxy()),tunnel=__importStar(require_tunnel2()),HttpCodes;(function(HttpCodes2){HttpCodes2[HttpCodes2.OK=200]="OK",HttpCodes2[HttpCodes2.MultipleChoices=300]="MultipleChoices",HttpCodes2[HttpCodes2.MovedPermanently=301]="MovedPermanently",HttpCodes2[HttpCodes2.ResourceMoved=302]="ResourceMoved",HttpCodes2[HttpCodes2.SeeOther=303]="SeeOther",HttpCodes2[HttpCodes2.NotModified=304]="NotModified",HttpCodes2[HttpCodes2.UseProxy=305]="UseProxy",HttpCodes2[HttpCodes2.SwitchProxy=306]="SwitchProxy",HttpCodes2[HttpCodes2.TemporaryRedirect=307]="TemporaryRedirect",HttpCodes2[HttpCodes2.PermanentRedirect=308]="PermanentRedirect",HttpCodes2[HttpCodes2.BadRequest=400]="BadRequest",HttpCodes2[HttpCodes2.Unauthorized=401
Error Code : ${error.statusCode}
Error Message: ${error.result.message}`)})).result)===null||_a===void 0?void 0:_a.value;if(!id_token)throw new Error("Response json body do not have ID Token field");return id_token})}static getIDToken(audience){return __awaiter(this,void 0,void 0,function*(){try{let id_token_url=_OidcClient.getIDTokenUrl();if(audience){let encodedAudience=encodeURIComponent(audience);id_token_url=`${id_token_url}&audience=${encodedAudience}`}core_1.debug(`ID token url is ${id_token_url}`);let id_token=yield _OidcClient.getCall(id_token_url);return core_1.setSecret(id_token),id_token}catch(error){throw new Error(`Error message: ${error.message}`)}})}};exports.OidcClient=OidcClient}});var require_summary=__commonJS({"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/summary.js"(exports){"use strict";var __awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0});exports.summary=exports.markdownSummary=exports.SUMMARY_DOCS_URL=exports.SUMMARY_ENV_VAR=void 0;var os_1=require("os"),fs_1=require("fs"),{access,appendFile,writeFile:writeFile2}=fs_1.promises;exports.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";exports.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Summary=class{constructor(){this._buffer=""}filePath(){return __awaiter(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let pathFromEnv=process.env[exports.SUMMARY_ENV_VAR];if(!pathFromEnv)throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield access(pathFromEnv,fs_1.constants.R_OK|fs_1.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`)}return this._filePath=pathFromEnv,this._filePath})}wrap(tag,content,attrs={}){let htmlAttrs=Object.entries(attrs).map(([key,value])=>` ${key}="${value}"`).join("");return content?`<${tag}${htmlAttrs}>${content}</${tag}>`:`<${tag}${htmlAttrs}>`}write(options){return __awaiter(this,void 0,void 0,function*(){let overwrite=!!options?.overwrite,filePath=yield this.filePath();return yield(overwrite?writeFile2:appendFile)(filePath,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return __awaiter(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(text,addEOL=!1){return this._buffer+=text,addEOL?this.addEOL():this}addEOL(){return this.addRaw(os_1.EOL)}addCodeBlock(code,lang){let attrs=Object.assign({},lang&&{lang}),element=this.wrap("pre",this.wrap("code",code),attrs);return this.addRaw(element).addEOL()}addList(items,ordered=!1){let tag=ordered?"ol":"ul",listItems=items.map(item=>this.wrap("li",item)).join(""),element=this.wrap(tag,listItems);return this.addRaw(element).addEOL()}addTable(rows){let tableBody=rows.map(row=>{let cells=row.map(cell=>{if(typeof cell=="string")return this.wrap("td",cell);let{header,data,colspan,rowspan}=cell,tag=header?"th":"td",attrs=Object.assign(Object.assign({},colspan&&{colspan}),rowspan&&{rowspan});return this.wrap(tag,data,attrs)}).join("");return this.wrap("tr",cells)}).join(""),element=this.wrap("table",tableBody);return this.addRaw(element).addEOL()}addDetails(label,content){let element=this.wrap("details",this.wrap("summary",label)+content);return this.addRaw(element).addEOL()}addImage(src,alt,options){le
`).filter(x=>x!=="");return options&&options.trimWhitespace===!1?inputs:inputs.map(input=>input.trim())}exports.getMultilineInput=getMultilineInput;function getBooleanInput(name,options){let trueValue=["true","True","TRUE"],falseValue=["false","False","FALSE"],val=getInput3(name,options);if(trueValue.includes(val))return!0;if(falseValue.includes(val))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}exports.getBooleanInput=getBooleanInput;function setOutput(name,value){if(process.env.GITHUB_OUTPUT||"")return file_command_1.issueFileCommand("OUTPUT",file_command_1.prepareKeyValueMessage(name,value));process.stdout.write(os.EOL),command_1.issueCommand("set-output",{name},utils_1.toCommandValue(value))}exports.setOutput=setOutput;function setCommandEcho(enabled){command_1.issue("echo",enabled?"on":"off")}exports.setCommandEcho=setCommandEcho;function setFailed3(message){process.exitCode=ExitCode.Failure,error(message)}exports.setFailed=setFailed3;function isDebug(){return process.env.RUNNER_DEBUG==="1"}exports.isDebug=isDebug;function debug(message){command_1.issueCommand("debug",{},message)}exports.debug=debug;function error(message,properties={}){command_1.issueCommand("error",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.error=error;function warning2(message,properties={}){command_1.issueCommand("warning",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.warning=warning2;function notice(message,properties={}){command_1.issueCommand("notice",utils_1.toCommandProperties(properties),message instanceof Error?message.toString():message)}exports.notice=notice;function info5(message){process.stdout.write(message+os.EOL)}exports.info=info5;function startGroup4(name){command_1.issue("group",name)}exports.startGroup=startGroup4;function endGroup4(){command_1.issue("endgroup")}exports.endGroup=endGroup4;function group(name,fn){return __awaiter(this,void 0,void 0,function*(){startGroup4(name);let result;try{result=yield fn()}finally{endGroup4()}return result})}exports.group=group;function saveState2(name,value){if(process.env.GITHUB_STATE||"")return file_command_1.issueFileCommand("STATE",file_command_1.prepareKeyValueMessage(name,value));command_1.issueCommand("save-state",{name},utils_1.toCommandValue(value))}exports.saveState=saveState2;function getState2(name){return process.env[`STATE_${name}`]||""}exports.getState=getState2;function getIDToken(aud){return __awaiter(this,void 0,void 0,function*(){return yield oidc_utils_1.OidcClient.getIDToken(aud)})}exports.getIDToken=getIDToken;var summary_1=require_summary();Object.defineProperty(exports,"summary",{enumerable:!0,get:function(){return summary_1.summary}});var summary_2=require_summary();Object.defineProperty(exports,"markdownSummary",{enumerable:!0,get:function(){return summary_2.markdownSummary}});var path_utils_1=require_path_utils();Object.defineProperty(exports,"toPosixPath",{enumerable:!0,get:function(){return path_utils_1.toPosixPath}});Object.defineProperty(exports,"toWin32Path",{enumerable:!0,get:function(){return path_utils_1.toWin32Path}});Object.defineProperty(exports,"toPlatformPath",{enumerable:!0,get:function(){return path_utils_1.toPlatformPath}})}});var require_io_util=__commonJS({"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:function(){return m[k]}})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)k!=="default"&&Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__awaiter=exports&&exports.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generato