Skip to content

Commit

Permalink
prettier console output
Browse files Browse the repository at this point in the history
  user doc dirs, user doc files, and changed files are now printed on a separate line each
  • Loading branch information
FG-TUM committed Jan 26, 2024
1 parent 75edcd0 commit a62a778
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
10 changes: 7 additions & 3 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,20 @@ describe('action', () => {
expect(getInputMock).toHaveBeenCalledTimes(5)

// Logs from run()
expect(infoMock).toHaveBeenCalledWith(`User doc directories: ${userDocDir}`)
expect(infoMock).toHaveBeenCalledWith(
`User doc directories:\n${userDocDir}`
)
expect(infoMock).toHaveBeenCalledWith(
`Parse user doc directories recursively: true`
)
expect(infoMock).toHaveBeenCalledWith(`Doc file extensions: .md`)
expect(infoMock).toHaveBeenCalledWith(
`Source file extensions: .ts,.cpp,.xyz`
)
expect(infoMock).toHaveBeenCalledWith(`User doc files: ${docfiles}`)
expect(infoMock).toHaveBeenCalledWith(`Changed files: ${changedFile}`)
expect(infoMock).toHaveBeenCalledWith(
`User doc files:${docfiles.reduce((acc, a) => `${acc}\n${a}`, '')}`
)
expect(infoMock).toHaveBeenCalledWith(`Changed files:\n${changedFile}`)

// Logs from checkDocumentation()
const dummyDocFileTags = [
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions dist/index.js

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

12 changes: 9 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ export async function run(): Promise<void> {
const splitRegex = /[\s,;]+/
// Get directories as arrays.
const dirs = core.getInput('userDocsDirs').split(splitRegex)
core.info(`User doc directories: ${dirs}`)
core.info(
`User doc directories:${dirs.reduce((acc, a) => `${acc}\n${a}`, '')}`
)
const recurseUserDocDirs =
core.getInput('recurseUserDocDirs').toLowerCase() === 'true'
core.info(`Parse user doc directories recursively: ${recurseUserDocDirs}`)
Expand All @@ -371,11 +373,15 @@ export async function run(): Promise<void> {
}
core.info(`Source file extensions: ${srcFileExtensions}`)
const docFiles = getDocFiles(dirs, docFileExtensions, recurseUserDocDirs)
core.info(`User doc files: ${docFiles}`)
core.info(
`User doc files:${docFiles.reduce((acc, a) => `${acc}\n${a}`, '')}`
)

// Get changes from the PR
const changedFiles = await getChangedFiles(ghToken)
core.info(`Changed files: ${changedFiles}`)
core.info(
`Changed files:${changedFiles.reduce((acc, a) => `${acc}\n${a}`, '')}`
)

// ------------------------- Check docs and tags --------------------------
const { unchangedDoc, unknownTags } = checkDocumentation(
Expand Down

0 comments on commit a62a778

Please sign in to comment.