INNER CODE UNIT · TypeScript
scanCodeRepository
dtinth/todo-actions · src/CodeRepository.ts:51
export async function scanCodeRepository(): Promise<CodeRepositoryState> {
log.info('Search for files with TODO tags...')
const filesWithTodoMarker = execSync('git grep -Il TODO', {
encoding: 'utf8',
})
.split('\n')
.filter(name => name)
const files: IFile[] = []
log.info('Parsing TODO tags...')
for (const filePath of filesWithTodoMarker) {
const file = new File(filePath)
files.push(file)
}
return {
files,
async saveChanges(commitMessage) {
const changedFiles = files.filter(file => file.contents.changed)
log.info('Files changed: %s', changedFiles.length)