Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Read json files only
Browse files Browse the repository at this point in the history
  • Loading branch information
runely committed Oct 27, 2021
1 parent 8c4642a commit 19ca50f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/move-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const sendNotification = require('./send-notification')
const generateError = require('../templates/error')
const generateWarning = require('../templates/warn')

const isJson = file => file.endsWith('.json')

const notify = async (args, body) => {
if (args.sendNotification) {
const notification = generateNotification(body)
Expand All @@ -20,7 +22,7 @@ const updateFile = (errorPath, fileName, content) => writeFileSync(`${errorPath}
const shouldRetry = content => new Date() >= new Date(content.retries.find(retry => !retry.executed).timestamp)

module.exports = async args => {
const fileNames = readdirSync(args.errorPath)
const fileNames = readdirSync(args.errorPath).filter(isJson)
fileNames.forEach(fileName => {
const content = require(`${args.errorPath}/${fileName}`)
const retryLength = (content.retries && content.retries.length) || 0
Expand Down

0 comments on commit 19ca50f

Please sign in to comment.