ci: bring back shouldUpdate check

This commit is contained in:
Bogdan Popa committed 2021-11-17 09:30:04 +02:00
1 parent e5aa35d978
commit dfd9dd3d5a
1 file changed
+11 -2
+11 -2
View File
@@ -20,8 +20,12 @@ let octokit
await core.group('Fetching repositories & updating lines...', async () => {
for (const repo of repos) {
const line = await generateLine(repo.repoStr)
core.info(`...repo line: '${line}'`)
lines[repo.index] = line
if (shouldUpdate(lines[repo.index], line)) {
lines[repo.index] = line
core.info(`...updated line: '${line}'`)
} else {
core.info(`...skipped line: '${line}'`)
}
}
})
@@ -75,3 +79,8 @@ async function generateBadge(repoStr) {
.map(s => encodeURIComponent(s.replace(/\-/g, '--')))
.join('-')
}
function shouldUpdate(oldLine, newLine) {
const badDateReg = /red\)$/
return badDateReg.test(oldLine) || !badDateReg.test(newLine)
}