Merge pull request #25 from richardrigutins/more-logs

Add more log messages
This commit is contained in:
Riccardo Rigutini 2023-08-14 11:20:22 +02:00 committed by GitHub
commit a51766e385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 5 deletions

View File

@ -47,6 +47,16 @@ jobs:
replacement-text: 'world' replacement-text: 'world'
exclude: '**/*.check.txt' exclude: '**/*.check.txt'
- name: Replace in Files - replace using environment variable
uses: ./
with:
search-text: '_ENV_'
files: '**/*.txt'
replacement-text: ${{ env.REPLACEMENT }}
exclude: '**/*.check.txt'
env:
REPLACEMENT: environment
- name: Replace in Files - pattern finds only one file - name: Replace in Files - pattern finds only one file
uses: ./ uses: ./
with: with:

4
dist/index.js generated vendored
View File

@ -35,10 +35,10 @@ function run() {
return; return;
} }
(0, core_1.info)(`Found ${filePaths.length} files for the given pattern.`); (0, core_1.info)(`Found ${filePaths.length} files for the given pattern.`);
(0, core_1.info)(`Replacing text...`); (0, core_1.info)(`Replacing "${searchText}" with "${replaceText}".`);
const encoding = inputEncoding; const encoding = inputEncoding;
const promises = filePaths.map((filePath) => __awaiter(this, void 0, void 0, function* () { const promises = filePaths.map((filePath) => __awaiter(this, void 0, void 0, function* () {
(0, core_1.debug)(`Replacing text in file ${filePath}`); (0, core_1.info)(`Replacing text in file ${filePath}`);
yield (0, utils_1.replaceTextInFile)(filePath, searchText, replaceText, encoding); yield (0, utils_1.replaceTextInFile)(filePath, searchText, replaceText, encoding);
})); }));
yield Promise.all(promises); yield Promise.all(promises);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -25,12 +25,12 @@ async function run(): Promise<void> {
} }
info(`Found ${filePaths.length} files for the given pattern.`); info(`Found ${filePaths.length} files for the given pattern.`);
info(`Replacing text...`); info(`Replacing "${searchText}" with "${replaceText}".`);
const encoding = inputEncoding as Encoding; const encoding = inputEncoding as Encoding;
const promises: Promise<void>[] = filePaths.map( const promises: Promise<void>[] = filePaths.map(
async (filePath: string) => { async (filePath: string) => {
debug(`Replacing text in file ${filePath}`); info(`Replacing text in file ${filePath}`);
await replaceTextInFile(filePath, searchText, replaceText, encoding); await replaceTextInFile(filePath, searchText, replaceText, encoding);
}, },
); );

View File

@ -2,3 +2,4 @@ Version: 1.0.2.
Hello world! Hello world!
This should be twenty-three: 23. This should be twenty-three: 23.
This line has been changed: false. This line has been changed: false.
This value comes from environment variables: environment

View File

@ -2,3 +2,4 @@ Version: @VERSION@.
Hello {0}! Hello {0}!
This should be twenty-three: 23. This should be twenty-three: 23.
This line has been changed: false. This line has been changed: false.
This value comes from environment variables: _ENV_