diff --git a/index.dist.js b/index.dist.js index ab5e4cd..d0ee5f0 100644 --- a/index.dist.js +++ b/index.dist.js @@ -159,7 +159,7 @@ If the error persists, please check whether Actions and API requests are operati Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information. If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`),i}})}};id.DefaultArtifactClient=sS});var Loe=h(Foe=>{"use strict";Object.defineProperty(Foe,"__esModule",{value:!0})});var Moe=h(Ga=>{"use strict";var vWe=Ga&&Ga.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),oS=Ga&&Ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vWe(e,t,r)};Object.defineProperty(Ga,"__esModule",{value:!0});var NWe=aS();oS(Loe(),Ga);oS(po(),Ga);oS(aS(),Ga);var _We=new NWe.DefaultArtifactClient;Ga.default=_We});var dS=h(oe=>{"use strict";var SWe=oe&&oe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),RWe=oe&&oe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qoe=oe&&oe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&SWe(e,t,r);return RWe(e,t),e},lS=oe&&oe.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{d(i.next(c))}catch(A){a(A)}}function l(c){try{d(i.throw(c))}catch(A){a(A)}}function d(c){c.done?s(c.value):n(c.value).then(o,l)}d((i=i.apply(t,e||[])).next())})},gn;Object.defineProperty(oe,"__esModule",{value:!0});oe.getCmdPath=oe.tryGetExecutablePath=oe.isRooted=oe.isDirectory=oe.exists=oe.READONLY=oe.UV_FS_O_EXLOCK=oe.IS_WINDOWS=oe.unlink=oe.symlink=oe.stat=oe.rmdir=oe.rm=oe.rename=oe.readlink=oe.readdir=oe.open=oe.mkdir=oe.lstat=oe.copyFile=oe.chmod=void 0;var Hoe=qoe(require("fs")),hI=qoe(require("path"));gn=Hoe.promises,oe.chmod=gn.chmod,oe.copyFile=gn.copyFile,oe.lstat=gn.lstat,oe.mkdir=gn.mkdir,oe.open=gn.open,oe.readdir=gn.readdir,oe.readlink=gn.readlink,oe.rename=gn.rename,oe.rm=gn.rm,oe.rmdir=gn.rmdir,oe.stat=gn.stat,oe.symlink=gn.symlink,oe.unlink=gn.unlink;oe.IS_WINDOWS=process.platform==="win32";oe.UV_FS_O_EXLOCK=268435456;oe.READONLY=Hoe.constants.O_RDONLY;function xWe(t){return lS(this,void 0,void 0,function*(){try{yield oe.stat(t)}catch(e){if(e.code==="ENOENT")return!1;throw e}return!0})}oe.exists=xWe;function TWe(t,e=!1){return lS(this,void 0,void 0,function*(){return(e?yield oe.stat(t):yield oe.lstat(t)).isDirectory()})}oe.isDirectory=TWe;function DWe(t){if(t=PWe(t),!t)throw new Error('isRooted() parameter "p" cannot be empty');return oe.IS_WINDOWS?t.startsWith("\\")||/^[A-Z]:/i.test(t):t.startsWith("/")}oe.isRooted=DWe;function kWe(t,e){return lS(this,void 0,void 0,function*(){let r;try{r=yield oe.stat(t)}catch(n){n.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${t}': ${n}`)}if(r&&r.isFile()){if(oe.IS_WINDOWS){let n=hI.extname(t).toUpperCase();if(e.some(s=>s.toUpperCase()===n))return t}else if(Uoe(r))return t}let i=t;for(let n of e){t=i+n,r=void 0;try{r=yield oe.stat(t)}catch(s){s.code!=="ENOENT"&&console.log(`Unexpected error attempting to determine if executable file exists '${t}': ${s}`)}if(r&&r.isFile()){if(oe.IS_WINDOWS){try{let s=hI.dirname(t),a=hI.basename(t).toUpperCase();for(let o of yield oe.readdir(s))if(a===o.toUpperCase()){t=hI.join(s,o);break}}catch(s){console.log(`Unexpected error attempting to determine the actual case of the file '${t}': ${s}`)}return t}else if(Uoe(r))return t}}return""})}oe.tryGetExecutablePath=kWe;function PWe(t){return t=t||"",oe.IS_WINDOWS?(t=t.replace(/\//g,"\\"),t.replace(/\\\\+/g,"\\")):t.replace(/\/\/+/g,"/")}function Uoe(t){return(t.mode&1)>0||(t.mode&8)>0&&t.gid===process.getgid()||(t.mode&64)>0&&t.uid===process.getuid()}function OWe(){var t;return(t=process.env.COMSPEC)!==null&&t!==void 0?t:"cmd.exe"}oe.getCmdPath=OWe});var Woe=h(Ar=>{"use strict";var FWe=Ar&&Ar.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),LWe=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Goe=Ar&&Ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&FWe(e,t,r);return LWe(e,t),e},nd=Ar&&Ar.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{d(i.next(c))}catch(A){a(A)}}function l(c){try{d(i.throw(c))}catch(A){a(A)}}function d(c){c.done?s(c.value):n(c.value).then(o,l)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.findInPath=Ar.which=Ar.mkdirP=Ar.rmRF=Ar.mv=Ar.cp=void 0;var MWe=require("assert"),za=Goe(require("path")),ft=Goe(dS());function UWe(t,e,r={}){return nd(this,void 0,void 0,function*(){let{force:i,recursive:n,copySourceDirectory:s}=HWe(r),a=(yield ft.exists(e))?yield ft.stat(e):null;if(a&&a.isFile()&&!i)return;let o=a&&a.isDirectory()&&s?za.join(e,za.basename(t)):e;if(!(yield ft.exists(t)))throw new Error(`no such file or directory: ${t}`);if((yield ft.stat(t)).isDirectory())if(n)yield Yoe(t,o,0,i);else throw new Error(`Failed to copy. ${t} is a directory, but tried to copy without recursive flag.`);else{if(za.relative(t,o)==="")throw new Error(`'${o}' and '${t}' are the same file`);yield Joe(t,o,i)}})}Ar.cp=UWe;function qWe(t,e,r={}){return nd(this,void 0,void 0,function*(){if(yield ft.exists(e)){let i=!0;if((yield ft.isDirectory(e))&&(e=za.join(e,za.basename(t)),i=yield ft.exists(e)),i)if(r.force==null||r.force)yield zoe(e);else throw new Error("Destination already exists")}yield cS(za.dirname(e)),yield ft.rename(t,e)})}Ar.mv=qWe;function zoe(t){return nd(this,void 0,void 0,function*(){if(ft.IS_WINDOWS&&/[*"<>|]/.test(t))throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');try{yield ft.rm(t,{force:!0,maxRetries:3,recursive:!0,retryDelay:300})}catch(e){throw new Error(`File was unable to be removed ${e}`)}})}Ar.rmRF=zoe;function cS(t){return nd(this,void 0,void 0,function*(){MWe.ok(t,"a path argument must be provided"),yield ft.mkdir(t,{recursive:!0})})}Ar.mkdirP=cS;function joe(t,e){return nd(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'tool' is required");if(e){let i=yield joe(t,!1);if(!i)throw ft.IS_WINDOWS?new Error(`Unable to locate executable file: ${t}. 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: ${t}. 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 i}let r=yield Voe(t);return r&&r.length>0?r[0]:""})}Ar.which=joe;function Voe(t){return nd(this,void 0,void 0,function*(){if(!t)throw new Error("parameter 'tool' is required");let e=[];if(ft.IS_WINDOWS&&process.env.PATHEXT)for(let n of process.env.PATHEXT.split(za.delimiter))n&&e.push(n);if(ft.isRooted(t)){let n=yield ft.tryGetExecutablePath(t,e);return n?[n]:[]}if(t.includes(za.sep))return[];let r=[];if(process.env.PATH)for(let n of process.env.PATH.split(za.delimiter))n&&r.push(n);let i=[];for(let n of r){let s=yield ft.tryGetExecutablePath(za.join(n,t),e);s&&i.push(s)}return i})}Ar.findInPath=Voe;function HWe(t){let e=t.force==null?!0:t.force,r=!!t.recursive,i=t.copySourceDirectory==null?!0:!!t.copySourceDirectory;return{force:e,recursive:r,copySourceDirectory:i}}function Yoe(t,e,r,i){return nd(this,void 0,void 0,function*(){if(r>=255)return;r++,yield cS(e);let n=yield ft.readdir(t);for(let s of n){let a=`${t}/${s}`,o=`${e}/${s}`;(yield ft.lstat(a)).isDirectory()?yield Yoe(a,o,r,i):yield Joe(a,o,i)}yield ft.chmod(e,(yield ft.stat(t)).mode)})}function Joe(t,e,r){return nd(this,void 0,void 0,function*(){if((yield ft.lstat(t)).isSymbolicLink()){try{yield ft.lstat(e),yield ft.unlink(e)}catch(n){n.code==="EPERM"&&(yield ft.chmod(e,"0666"),yield ft.unlink(e))}let i=yield ft.readlink(t);yield ft.symlink(i,e,ft.IS_WINDOWS?"junction":null)}else(!(yield ft.exists(e))||r)&&(yield ft.copyFile(t,e))})}});var Zoe=h(En=>{"use strict";var GWe=En&&En.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),zWe=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lf=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&GWe(e,t,r);return zWe(e,t),e},$oe=En&&En.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{d(i.next(c))}catch(A){a(A)}}function l(c){try{d(i.throw(c))}catch(A){a(A)}}function d(c){c.done?s(c.value):n(c.value).then(o,l)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(En,"__esModule",{value:!0});En.argStringToArray=En.ToolRunner=void 0;var mI=Lf(require("os")),Xoe=Lf(require("events")),jWe=Lf(require("child_process")),VWe=Lf(require("path")),YWe=Lf(Woe()),Koe=Lf(dS()),JWe=require("timers"),gI=process.platform==="win32",AS=class extends Xoe.EventEmitter{constructor(e,r,i){if(super(),!e)throw new Error("Parameter 'toolPath' cannot be null or empty.");this.toolPath=e,this.args=r||[],this.options=i||{}}_debug(e){this.options.listeners&&this.options.listeners.debug&&this.options.listeners.debug(e)}_getCommandString(e,r){let i=this._getSpawnFileName(),n=this._getSpawnArgs(e),s=r?"":"[command]";if(gI)if(this._isCmdFile()){s+=i;for(let a of n)s+=` ${a}`}else if(e.windowsVerbatimArguments){s+=`"${i}"`;for(let a of n)s+=` ${a}`}else{s+=this._windowsQuoteCmdArg(i);for(let a of n)s+=` ${this._windowsQuoteCmdArg(a)}`}else{s+=i;for(let a of n)s+=` ${a}`}return s}_processLineBuffer(e,r,i){try{let n=r+e.toString(),s=n.indexOf(mI.EOL);for(;s>-1;){let a=n.substring(0,s);i(a),n=n.substring(s+mI.EOL.length),s=n.indexOf(mI.EOL)}return n}catch(n){return this._debug(`error processing line. Failed with error ${n}`),""}}_getSpawnFileName(){return gI&&this._isCmdFile()?process.env.COMSPEC||"cmd.exe":this.toolPath}_getSpawnArgs(e){if(gI&&this._isCmdFile()){let r=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(let i of this.args)r+=" ",r+=e.windowsVerbatimArguments?i:this._windowsQuoteCmdArg(i);return r+='"',[r]}return this.args}_endsWith(e,r){return e.endsWith(r)}_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 r=[" "," ","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'],i=!1;for(let a of e)if(r.some(o=>o===a)){i=!0;break}if(!i)return e;let n='"',s=!0;for(let a=e.length;a>0;a--)n+=e[a-1],s&&e[a-1]==="\\"?n+="\\":e[a-1]==='"'?(s=!0,n+='"'):s=!1;return n+='"',n.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 r='"',i=!0;for(let n=e.length;n>0;n--)r+=e[n-1],i&&e[n-1]==="\\"?r+="\\":e[n-1]==='"'?(i=!0,r+="\\"):i=!1;return r+='"',r.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};let r={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 r.outStream=e.outStream||process.stdout,r.errStream=e.errStream||process.stderr,r}_getSpawnOptions(e,r){e=e||{};let i={};return i.cwd=e.cwd,i.env=e.env,i.windowsVerbatimArguments=e.windowsVerbatimArguments||this._isCmdFile(),e.windowsVerbatimArguments&&(i.argv0=`"${r}"`),i}exec(){return $oe(this,void 0,void 0,function*(){return!Koe.isRooted(this.toolPath)&&(this.toolPath.includes("/")||gI&&this.toolPath.includes("\\"))&&(this.toolPath=VWe.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)),this.toolPath=yield YWe.which(this.toolPath,!0),new Promise((e,r)=>$oe(this,void 0,void 0,function*(){this._debug(`exec tool: ${this.toolPath}`),this._debug("arguments:");for(let d of this.args)this._debug(` ${d}`);let i=this._cloneExecOptions(this.options);!i.silent&&i.outStream&&i.outStream.write(this._getCommandString(i)+mI.EOL);let n=new uS(i,this.toolPath);if(n.on("debug",d=>{this._debug(d)}),this.options.cwd&&!(yield Koe.exists(this.options.cwd)))return r(new Error(`The cwd: ${this.options.cwd} does not exist!`));let s=this._getSpawnFileName(),a=jWe.spawn(s,this._getSpawnArgs(i),this._getSpawnOptions(this.options,s)),o="";a.stdout&&a.stdout.on("data",d=>{this.options.listeners&&this.options.listeners.stdout&&this.options.listeners.stdout(d),!i.silent&&i.outStream&&i.outStream.write(d),o=this._processLineBuffer(d,o,c=>{this.options.listeners&&this.options.listeners.stdline&&this.options.listeners.stdline(c)})});let l="";if(a.stderr&&a.stderr.on("data",d=>{n.processStderr=!0,this.options.listeners&&this.options.listeners.stderr&&this.options.listeners.stderr(d),!i.silent&&i.errStream&&i.outStream&&(i.failOnStdErr?i.errStream:i.outStream).write(d),l=this._processLineBuffer(d,l,c=>{this.options.listeners&&this.options.listeners.errline&&this.options.listeners.errline(c)})}),a.on("error",d=>{n.processError=d.message,n.processExited=!0,n.processClosed=!0,n.CheckComplete()}),a.on("exit",d=>{n.processExitCode=d,n.processExited=!0,this._debug(`Exit code ${d} received from tool '${this.toolPath}'`),n.CheckComplete()}),a.on("close",d=>{n.processExitCode=d,n.processExited=!0,n.processClosed=!0,this._debug(`STDIO streams have closed for tool '${this.toolPath}'`),n.CheckComplete()}),n.on("done",(d,c)=>{o.length>0&&this.emit("stdline",o),l.length>0&&this.emit("errline",l),a.removeAllListeners(),d?r(d):e(c)}),this.options.input){if(!a.stdin)throw new Error("child process missing stdin");a.stdin.end(this.options.input)}}))})}};En.ToolRunner=AS;function WWe(t){let e=[],r=!1,i=!1,n="";function s(a){i&&a!=='"'&&(n+="\\"),n+=a,i=!1}for(let a=0;a0&&(e.push(n),n="");continue}s(o)}return n.length>0&&e.push(n.trim()),e}En.argStringToArray=WWe;var uS=class t extends Xoe.EventEmitter{constructor(e,r){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,!r)throw new Error("toolPath must not be empty");this.options=e,this.toolPath=r,e.delay&&(this.delay=e.delay)}CheckComplete(){this.done||(this.processClosed?this._setResult():this.processExited&&(this.timeout=JWe.setTimeout(t.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 r=`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(r)}e._setResult()}}}});var nle=h(yn=>{"use strict";var $We=yn&&yn.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),KWe=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XWe=yn&&yn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&$We(e,t,r);return KWe(e,t),e},rle=yn&&yn.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function o(c){try{d(i.next(c))}catch(A){a(A)}}function l(c){try{d(i.throw(c))}catch(A){a(A)}}function d(c){c.done?s(c.value):n(c.value).then(o,l)}d((i=i.apply(t,e||[])).next())})};Object.defineProperty(yn,"__esModule",{value:!0});yn.getExecOutput=yn.exec=void 0;var ele=require("string_decoder"),tle=XWe(Zoe());function ile(t,e,r){return rle(this,void 0,void 0,function*(){let i=tle.argStringToArray(t);if(i.length===0)throw new Error("Parameter 'commandLine' cannot be null or empty.");let n=i[0];return e=i.slice(1).concat(e||[]),new tle.ToolRunner(n,e,r).exec()})}yn.exec=ile;function ZWe(t,e,r){var i,n;return rle(this,void 0,void 0,function*(){let s="",a="",o=new ele.StringDecoder("utf8"),l=new ele.StringDecoder("utf8"),d=(i=r?.listeners)===null||i===void 0?void 0:i.stdout,c=(n=r?.listeners)===null||n===void 0?void 0:n.stderr,A=m=>{a+=l.write(m),c&&c(m)},u=m=>{s+=o.write(m),d&&d(m)},p=Object.assign(Object.assign({},r?.listeners),{stdout:u,stderr:A}),f=yield ile(t,e,Object.assign(Object.assign({},r),{listeners:p}));return s+=o.end(),a+=l.end(),{exitCode:f,stdout:s,stderr:a}})}yn.getExecOutput=ZWe});var sle=ld(Moe()),Di=ld(ni()),en=ld(nle()),ale=ld(VA()),Vc=require("fs/promises");async function e$e(){(0,Di.setOutput)("autofix_started",!1);let t=JSON.parse(await(0,Vc.readFile)(process.env.GITHUB_EVENT_PATH,{encoding:"utf8"}));if((0,Di.isDebug)()&&console.log(t),process.env.GITHUB_WORKFLOW!=="autofix.ci")throw'For security reasons, the workflow in which the autofix.ci action is used must be named "autofix.ci".';await(0,en.exec)("git",["reset"]),await(0,en.exec)("git",["-c","core.fileMode=false","add","--all"]);let{stdout:e}=await(0,en.getExecOutput)("git",["diff","--name-only","--staged","--no-renames"]);if(e===""){console.log("Nothing to do! \u2728");return}let r=e.trim().split(` -`);if(r.some(c=>c.includes(".github")))throw"The autofix.ci action is not allowed to modify the .github directory.";if(console.log(`Need to update ${r.length} files.`),t.pull_request){await(0,en.exec)("git",["config","user.name","autofix.ci"]),await(0,en.exec)("git",["config","user.email","noreply@autofix.ci"]),await(0,en.exec)("git",["commit","-m","autofix"]);let c=(await(0,en.getExecOutput)("git",["rev-parse","HEAD"])).stdout.trim();(0,Di.isDebug)()&&await(0,en.exec)("git",["show",c]),await(0,en.exec)("git",["fetch","--depth=1","origin",`+refs/pull/${t.pull_request.number}/head`]),await(0,en.exec)("git",["checkout","--force","FETCH_HEAD"]),(0,Di.isDebug)()&&await(0,en.exec)("git",["status"]),await(0,en.exec)("git",["cherry-pick","--no-commit",c])}let i={additions:[],deletions:[]};await Promise.all(r.map(async c=>{let A;try{A=await(0,Vc.readFile)(c)}catch{i.deletions.push({path:c});return}i.additions.push({path:c,contents:A.toString("base64")})})),(0,Di.isDebug)()&&console.log(i);let n=new sle.DefaultArtifactClient,s="autofix.json";try{await(0,Vc.writeFile)(s,JSON.stringify({version:1,changes:i,failFast:(0,Di.getInput)("fail-fast")==="true",comment:(0,Di.getInput)("comment")||void 0,commitMessage:(0,Di.getInput)("commit-message")||void 0})),await n.uploadArtifact("autofix.ci",[s],".",{retentionDays:1})}finally{await(0,Vc.rm)(s,{maxRetries:3})}let a="https://api.autofix.ci/fix?owner="+encodeURIComponent(t.repository.owner.login)+"&repo="+encodeURIComponent(t.repository.name);t.pull_request?a+="&pull="+encodeURIComponent(t.pull_request.number):a+="&branch="+encodeURIComponent(t.ref.replace(/^refs\/heads\//,""));let l=await new ale.HttpClient("autofix-action/v2").post(a,null),d=await l.readBody();l.message.statusCode===200?((0,Di.setFailed)("\u2705 Autofix task started."),(0,Di.setOutput)("autofix_started",!0)):(console.log(l.message.statusCode,d),(0,Di.setFailed)(d)),await(0,en.exec)("git",["diff","--staged"])}(async function(){try{await e$e()}catch(e){(0,Di.setFailed)(String(e).replace(/^Error: /,""))}})(); +`);if(r.some(c=>c.includes(".github")))throw"The autofix.ci action is not allowed to modify the .github directory.";if(console.log(`Need to update ${r.length} files.`),t.pull_request){await(0,en.exec)("git",["config","user.name","autofix.ci"]),await(0,en.exec)("git",["config","user.email","noreply@autofix.ci"]),await(0,en.exec)("git",["commit","--no-verify","-m","autofix"]);let c=(await(0,en.getExecOutput)("git",["rev-parse","HEAD"])).stdout.trim();(0,Di.isDebug)()&&await(0,en.exec)("git",["show",c]),await(0,en.exec)("git",["fetch","--depth=1","origin",`+refs/pull/${t.pull_request.number}/head`]),await(0,en.exec)("git",["checkout","--force","FETCH_HEAD"]),(0,Di.isDebug)()&&await(0,en.exec)("git",["status"]),await(0,en.exec)("git",["cherry-pick","--no-commit",c])}let i={additions:[],deletions:[]};await Promise.all(r.map(async c=>{let A;try{A=await(0,Vc.readFile)(c)}catch{i.deletions.push({path:c});return}i.additions.push({path:c,contents:A.toString("base64")})})),(0,Di.isDebug)()&&console.log(i);let n=new sle.DefaultArtifactClient,s="autofix.json";try{await(0,Vc.writeFile)(s,JSON.stringify({version:1,changes:i,failFast:(0,Di.getInput)("fail-fast")==="true",comment:(0,Di.getInput)("comment")||void 0,commitMessage:(0,Di.getInput)("commit-message")||void 0})),await n.uploadArtifact("autofix.ci",[s],".",{retentionDays:1})}finally{await(0,Vc.rm)(s,{maxRetries:3})}let a="https://api.autofix.ci/fix?owner="+encodeURIComponent(t.repository.owner.login)+"&repo="+encodeURIComponent(t.repository.name);t.pull_request?a+="&pull="+encodeURIComponent(t.pull_request.number):a+="&branch="+encodeURIComponent(t.ref.replace(/^refs\/heads\//,""));let l=await new ale.HttpClient("autofix-action/v2").post(a,null),d=await l.readBody();l.message.statusCode===200?((0,Di.setFailed)("\u2705 Autofix task started."),(0,Di.setOutput)("autofix_started",!0)):(console.log(l.message.statusCode,d),(0,Di.setFailed)(d)),await(0,en.exec)("git",["diff","--staged"])}(async function(){try{await e$e()}catch(e){(0,Di.setFailed)(String(e).replace(/^Error: /,""))}})(); /*! Bundled license information: undici/lib/fetch/body.js: diff --git a/index.ts b/index.ts index 27097ae..f74d449 100644 --- a/index.ts +++ b/index.ts @@ -45,6 +45,7 @@ async function main() { await exec("git", ["config", "user.email", "noreply@autofix.ci"]); await exec("git", [ "commit", + "--no-verify", "-m", "autofix", ]); let commit_hash = (