From c2c73b16c1b6f8ad9df8cfe3ba50324a4af897e4 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 29 Jan 2022 04:45:17 +0530 Subject: [PATCH] Append to script instead read then write --- dist/index.js | 4 ++-- src/install.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index ad156132..83c4d165 100644 --- a/dist/index.js +++ b/dist/index.js @@ -455,7 +455,7 @@ async function getScript(filename, version, os_version) { const coverage_driver = await utils.getInput('coverage', false); const tools_csv = await utils.getInput('tools', false); const script_path = path_1.default.join(__dirname, '../src/scripts', filename); - let script = fs_1.default.readFileSync(script_path, 'utf8'); + let script = '\n'; if (extension_csv) { script += await extensions.addExtension(extension_csv, version, os_version); } @@ -468,7 +468,7 @@ async function getScript(filename, version, os_version) { } script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os_version)); script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os_version)); - fs_1.default.writeFileSync(script_path, script, { mode: 0o755 }); + fs_1.default.appendFileSync(script_path, script, { mode: 0o755 }); return script_path; } exports.getScript = getScript; diff --git a/src/install.ts b/src/install.ts index 40e79a96..b9a10118 100644 --- a/src/install.ts +++ b/src/install.ts @@ -28,7 +28,7 @@ export async function getScript( const coverage_driver: string = await utils.getInput('coverage', false); const tools_csv: string = await utils.getInput('tools', false); const script_path = path.join(__dirname, '../src/scripts', filename); - let script: string = fs.readFileSync(script_path, 'utf8'); + let script = '\n'; if (extension_csv) { script += await extensions.addExtension(extension_csv, version, os_version); } @@ -42,7 +42,7 @@ export async function getScript( script += '\n' + (await utils.stepLog(`Sponsor setup-php`, os_version)); script += '\n' + (await utils.addLog('$tick', 'setup-php', url, os_version)); - fs.writeFileSync(script_path, script, {mode: 0o755}); + fs.appendFileSync(script_path, script, {mode: 0o755}); return script_path; }