Skip to content

Commit

Permalink
Refactor updateReadme function
Browse files Browse the repository at this point in the history
  • Loading branch information
jill64 committed Dec 20, 2023
1 parent 9b2e7f7 commit 8164dc4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/action/src/ghosts/docs/updateReadme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ export const updateReadme =
}) =>
async (readmePath: string): Promise<boolean> => {
const readme = await readFile(readmePath, 'utf-8')

if (!readme) {
core.info(`[${readmePath}]: No readme found.`)
return false
}

const dir = path.dirname(readmePath)

Check warning on line 22 in packages/action/src/ghosts/docs/updateReadme.ts

View check run for this annotation

Codecov / codecov/patch

packages/action/src/ghosts/docs/updateReadme.ts#L22

Added line #L22 was not covered by tests
const packageJsonPath = path.join(dir, 'package.json')
const packageJsonStr = await readFile(packageJsonPath, 'utf-8')

Check warning on line 25 in packages/action/src/ghosts/docs/updateReadme.ts

View check run for this annotation

Codecov / codecov/patch

packages/action/src/ghosts/docs/updateReadme.ts#L25

Added line #L25 was not covered by tests
const json = JSON.parse(packageJsonStr)
const packageJson = isValidPackageJson(json) ? json : null

Expand Down

0 comments on commit 8164dc4

Please sign in to comment.