From edaaceb5579d14bee1f29e1f60f20a26512973ad Mon Sep 17 00:00:00 2001 From: Yohay Nahmany Date: Thu, 21 Nov 2024 14:35:05 +0100 Subject: [PATCH] wip --- dist/post.js | 27 +++++++++++++++------------ src/post.ts | 29 ++++++++++++++--------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/dist/post.js b/dist/post.js index 0f8cd2e..196d8a6 100644 --- a/dist/post.js +++ b/dist/post.js @@ -26179,9 +26179,14 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); const core = __importStar(__nccwpck_require__(7484)); const exec = __importStar(__nccwpck_require__(5236)); +const path_1 = __importDefault(__nccwpck_require__(6928)); +const fs_1 = __importDefault(__nccwpck_require__(9896)); function getPostState() { return { or8n: core.getState('or8n') === 'true', @@ -26216,23 +26221,21 @@ async function run() { options.push(`--path ${state.path}`); } if (state.pwOutputDir) { - // const lastRunFilePath = path.resolve( - // state.pwOutputDir ?? 'test-results', - // '.last-run.json' - // ) - // options.push('--yohay'); - // if (!fs.existsSync(lastRunFilePath)) { - // // Create the file and optionally initialize it with some content - // fs.writeFileSync(lastRunFilePath, '', { encoding: 'utf-8' }); - // console.log(`File created at: ${lastRunFilePath}`); - // } else { - // console.log(`File already exists at: ${lastRunFilePath}`); - // } options.push(`--pw-output-dir ${state.pwOutputDir}`); } if (state.debug) { options.push(`--debug`); } + const lastRunFilePath = path_1.default.resolve(state.pwOutputDir ?? 'test-results', '.last-run.json'); + options.push('--yohay'); + if (!fs_1.default.existsSync(lastRunFilePath)) { + // Create the file and optionally initialize it with some content + fs_1.default.writeFileSync(lastRunFilePath, '', { encoding: 'utf-8' }); + console.log(`File created at: ${lastRunFilePath}`); + } + else { + console.log(`File already exists at: ${lastRunFilePath}`); + } const cacheSetCommand = `npx currents cache set ${options.join(' ')}`; await exec.exec(cacheSetCommand); } diff --git a/src/post.ts b/src/post.ts index 0ae8ef4..979042d 100644 --- a/src/post.ts +++ b/src/post.ts @@ -1,7 +1,7 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' -// import path from 'path' -// import fs from 'fs' +import path from 'path' +import fs from 'fs' interface PostState { or8n?: boolean @@ -55,25 +55,24 @@ async function run(): Promise { } if (state.pwOutputDir) { - // const lastRunFilePath = path.resolve( - // state.pwOutputDir ?? 'test-results', - // '.last-run.json' - // ) - // options.push('--yohay'); - // if (!fs.existsSync(lastRunFilePath)) { - // // Create the file and optionally initialize it with some content - // fs.writeFileSync(lastRunFilePath, '', { encoding: 'utf-8' }); - // console.log(`File created at: ${lastRunFilePath}`); - // } else { - // console.log(`File already exists at: ${lastRunFilePath}`); - // } options.push(`--pw-output-dir ${state.pwOutputDir}`) } if (state.debug) { options.push(`--debug`) } - + const lastRunFilePath = path.resolve( + state.pwOutputDir ?? 'test-results', + '.last-run.json' + ) + options.push('--yohay'); + if (!fs.existsSync(lastRunFilePath)) { + // Create the file and optionally initialize it with some content + fs.writeFileSync(lastRunFilePath, '', { encoding: 'utf-8' }); + console.log(`File created at: ${lastRunFilePath}`); + } else { + console.log(`File already exists at: ${lastRunFilePath}`); + } const cacheSetCommand = `npx currents cache set ${options.join(' ')}` await exec.exec(cacheSetCommand)