Skip to content

Commit

Permalink
1.8.14
Browse files Browse the repository at this point in the history
  • Loading branch information
maso7 committed Jun 25, 2024
1 parent 83b0cc4 commit 4152e00
Show file tree
Hide file tree
Showing 6 changed files with 89,475 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 20.9.0
act 0.2.62
act 0.2.63
73 changes: 37 additions & 36 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

73 changes: 37 additions & 36 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,42 +97,43 @@ function printMatch(match) {
}
console.log(message);
}
// async function checkFile(filePath, patterns) {
// // Check if the file exists before attempting to open it
// if (!fs.existsSync(filePath)) {
// const errorMessage = `The specified file does not exist: ${filePath}`;
// core.setFailed(errorMessage);
// console.error(errorMessage);
// return; // Exit the function if the file does not exist
// }
//
// try {
// const fileStream = fs.createReadStream(filePath);
// const rl = readline.createInterface({
// input: fileStream,
// crlfDelay: Infinity
// });
//
// let lineNumber = 0;
//
// for await (const line of rl) {
// lineNumber++;
//
// patterns.forEach(pattern => {
// if (pattern.regex.test(line)) {
// let message = `Line ${lineNumber}: ${pattern.result}`;
// if (pattern.showLine && pattern.showLine > 0) {
// message += ` | Line content: "${line}"`;
// }
// console.log(message);
// }
// });
// }
// } catch (error) {
// core.setFailed(`An error occurred while processing the file: ${error.message}`);
// // console.error(`An error occurred while processing the file: ${error.message}`);
// }
// }

async function checkFile(filePath, patterns) {
// Check if the file exists before attempting to open it
if (!fs.existsSync(filePath)) {
const errorMessage = `The specified file does not exist: ${filePath}`;
core.setFailed(errorMessage);
console.error(errorMessage);
return; // Exit the function if the file does not exist
}

try {
const fileStream = fs.createReadStream(filePath);
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
});

let lineNumber = 0;

for await (const line of rl) {
lineNumber++;

patterns.forEach(pattern => {
if (pattern.regex.test(line)) {
let message = `Line ${lineNumber}: ${pattern.result}`;
if (pattern.showLine && pattern.showLine > 0) {
message += ` | Line content: "${line}"`;
}
console.log(message);
}
});
}
} catch (error) {
core.setFailed(`An error occurred while processing the file: ${error.message}`);
// console.error(`An error occurred while processing the file: ${error.message}`);
}
}

async function run() {
try {
Expand Down
1 change: 1 addition & 0 deletions tmp.json

Large diffs are not rendered by default.

Loading

0 comments on commit 4152e00

Please sign in to comment.