diff --git a/lib/metadata.js b/lib/metadata.js index 187d097..bac3258 100644 --- a/lib/metadata.js +++ b/lib/metadata.js @@ -46,12 +46,12 @@ module.exports = { const match = body.match(regex) if (match) { - let obj = JSON.parse(match[1]); + let obj = JSON.parse(match[1]) let data = obj[process.env.GITHUB_ACTION] - if(!data){ - //attempt to rescue orphaned data - for (const [appid, value] of Object.entries(obj)) { - data = (obj[appid].hasOwnProperty('class') && obj[appid].class == "reminders2.0") || (obj[appid].hasOwnProperty('who') && obj[appid].hasOwnProperty('when') && obj[appid].hasOwnProperty('what')) ? obj[appid] : null; + if (!data) { + // attempt to rescue orphaned data + for (const [appid] of Object.entries(obj)) { + data = (obj[appid].hasOwnProperty('class') && obj[appid].class === 'reminders2.0') || (obj[appid].hasOwnProperty('who') && obj[appid].hasOwnProperty('when') && obj[appid].hasOwnProperty('what')) ? obj[appid] : null } } return key ? data && data[key] : data diff --git a/lib/reminders.js b/lib/reminders.js index 8023f6d..1e7af73 100644 --- a/lib/reminders.js +++ b/lib/reminders.js @@ -75,7 +75,7 @@ module.exports = { if (!context.octokit) { octokit = new Octokit() } else { octokit = context.octokit } const reminder = parseReminder(command.name + ' ' + command.arguments) - reminder.class = 'reminders2.0'; + reminder.class = 'reminders2.0' if (reminder) { if (reminder.who === 'me') {