Skip to content

Commit

Permalink
Improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
kiliczsh committed May 1, 2021
1 parent 360c62f commit d58e31b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .idea/workspace.xml

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

21 changes: 9 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8589,25 +8589,22 @@ try {

const keyword = core.getInput('scan-keyword');
const codebasepath = core.getInput('codebase-path');
console.log(`Keyword: ${keyword}!`);
console.log(`Codebase Path: ${codebasepath}!`);
console.log(`Searching for ${keyword} in ${codebasepath}!`);

let scanResult = "";
fif.find(keyword, codebasepath, '.js$')
.then(function(results) {
core.setOutput("result", results);
for (let result in results) {
let res = results[result];
console.log(
'Found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"'
);
let msg = 'Found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"';
scanResult += msg + "\r\n";
}
});

// let currentPath = process.cwd();
// console.log(currentPath);
// const payload = JSON.stringify(github.context.payload, undefined, 2)
// console.log(`The event payload: ${payload}`);
if(scanResult === ""){
scanResult = "No results found!";
}
console.log(scanResult);
} catch (error) {
core.setFailed(error.message);
}
Expand Down
21 changes: 9 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@ try {

const keyword = core.getInput('scan-keyword');
const codebasepath = core.getInput('codebase-path');
console.log(`Keyword: ${keyword}!`);
console.log(`Codebase Path: ${codebasepath}!`);
console.log(`Searching for ${keyword} in ${codebasepath}!`);

let scanResult = "";
fif.find(keyword, codebasepath, '.js$')
.then(function(results) {
core.setOutput("result", results);
for (let result in results) {
let res = results[result];
console.log(
'Found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"'
);
let msg = 'Found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"';
scanResult += msg + "\r\n";
}
});

// let currentPath = process.cwd();
// console.log(currentPath);
// const payload = JSON.stringify(github.context.payload, undefined, 2)
// console.log(`The event payload: ${payload}`);
if(scanResult === ""){
scanResult = "No results found!";
}
console.log(scanResult);
} catch (error) {
core.setFailed(error.message);
}

0 comments on commit d58e31b

Please sign in to comment.