Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
Revert "=" usage
  • Loading branch information
mh4647 committed Sep 5, 2022
1 parent d09fdd9 commit 6a1fbb3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ try {
const vars_string = core.getInput('replacements');
var filenames = files.replace(' ', '').split(',')
var vars = vars_string.split(',')
console.log('files l:'+ filenames.length)
for(var fi = 0; fi < filenames.length; fi++)
{
console.log('files l:' + filenames.length)
for (var fi = 0; fi < filenames.length; fi++) {
var filename = filenames[fi]
var fs = require('fs')
console.log('file1: '+ fi + ' '+filename)
fs.readFile(filename, 'utf8', function (err,data) {
console.log('file1: ' + fi + ' ' + filename)
fs.readFile(filename, 'utf8', function (err, data) {
if (err) {
console.log(err);
} else {
var result = data
console.log(data)
for(var i = 0; i < vars.length; i++)
{
var firstEqual = vars[i].indexOf('=');
var key = vars[i].substr(0,firstEqual);
var value = vars[i].substr(firstEqual+1);
result = result.replace(key, value)
for (var i = 0; i < vars.length; i++) {
var kv = vars[i].split('=')
var key = kv[0]
var value = kv[1]
console.log("key: " + key);
console.log("Value: " + value);
result = result.replace(key, value)
}
console.log('file2: '+filename)
console.log('file2: ' + filename)
fs.writeFile(filename, result, 'utf8', function (err) {
if (err)
if (err)
console.log(err)
else
else
console.log(result)
});
}
Expand Down

0 comments on commit 6a1fbb3

Please sign in to comment.