diff --git a/lib/move-files.js b/lib/move-files.js index f7ca2b6..8331d6e 100644 --- a/lib/move-files.js +++ b/lib/move-files.js @@ -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) @@ -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