Skip to content

Commit

Permalink
Improve log output
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Apr 11, 2021
1 parent f093f35 commit d0507d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4712,6 +4712,7 @@ async function run() {
}
const filter = new filter_1.Filter(filtersYaml);
const files = await getChangedFiles(token, base, ref, initialFetchDepth);
core.info(`Detected ${files.length} changed files`);
const results = filter.match(files);
exportResults(results, listFiles);
}
Expand Down Expand Up @@ -4808,10 +4809,11 @@ async function getChangedFilesFromApi(token, pullRequest) {
if (response.status !== 200) {
throw new Error(`Fetching list of changed files from GitHub API failed with error code ${response.status}`);
}
core.info(`Received ${response.data.length} items`);
if (response.data.length === 0) {
core.info('All changed files has been fetched from GitHub API');
break;
}
core.info(`Received ${response.data.length} items`);
for (const row of response.data) {
core.info(`[${row.status}] ${row.filename}`);
// There's no obvious use-case for detection of renames
Expand All @@ -4838,7 +4840,6 @@ async function getChangedFilesFromApi(token, pullRequest) {
}
}
}
core.info(`Found ${files.length} changed files`);
return files;
}
finally {
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async function run(): Promise<void> {

const filter = new Filter(filtersYaml)
const files = await getChangedFiles(token, base, ref, initialFetchDepth)
core.info(`Detected ${files.length} changed files`)
const results = filter.match(files)
exportResults(results, listFiles)
} catch (error) {
Expand Down Expand Up @@ -151,11 +152,12 @@ async function getChangedFilesFromApi(
throw new Error(`Fetching list of changed files from GitHub API failed with error code ${response.status}`)
}

core.info(`Received ${response.data.length} items`)
if (response.data.length === 0) {
core.info('All changed files has been fetched from GitHub API')
break
}

core.info(`Received ${response.data.length} items`)
for (const row of response.data) {
core.info(`[${row.status}] ${row.filename}`)
// There's no obvious use-case for detection of renames
Expand All @@ -182,7 +184,6 @@ async function getChangedFilesFromApi(
}
}

core.info(`Found ${files.length} changed files`)
return files
} finally {
core.endGroup()
Expand Down

0 comments on commit d0507d9

Please sign in to comment.