Skip to content

Commit

Permalink
Fix undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSaini101 committed Jul 24, 2024
1 parent bcff426 commit 66db3e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/scripts/vote_tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ module.exports = async ({ context }) => {
console.error('Error reading voteTrackingFile.json:', readError);
throw readError;
}
let updatedVoteDetails = [...voteDetails]
const updatedTSCMembers = [];
const requiredKeys = ['name', 'lastParticipatedVoteTime', 'isVotedInLast3Months', 'lastVoteClosedTime', 'agreeCount', 'disagreeCount', 'abstainCount', 'notParticipatingCount'];
// Function to check if an object has all required keys
Expand Down Expand Up @@ -230,18 +231,19 @@ module.exports = async ({ context }) => {
} else {
console.log('No valid example member found in voteDetails.');
}

if (updatedTSCMembers.length > 0) {
try {
const combinedData = [...voteDetails, ...updatedTSCMembers];
await writeFile(voteTrackingFile, JSON.stringify(combinedData, null, 2));
return combinedData; // Return the updated data
updatedVoteDetails = [...combinedData]
} catch (writeError) {
console.error('Error wile writing file:' ,writeError)
}
}
return combinedData
}
} catch (error) {
console.error('Error while running the vote_tracker workflow:', error);
}
}
}

0 comments on commit 66db3e2

Please sign in to comment.