Skip to content

Commit

Permalink
validate all links and log when task ends
Browse files Browse the repository at this point in the history
  • Loading branch information
libotony committed Jan 31, 2024
1 parent cd5a08d commit 92f9673
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions scripts/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,37 @@ if (github.context.eventName === 'pull_request') {
console.log(colors.green(`Validation passed, Congrats!`))
process.exit(0)
})
} else {
} else if (process.argv.length > 2 && process.argv[2] === 'link') {
// run link validation
console.log(colors.green('Validating app links......'))
let msg = ''
void (async () => {
let dirs = await promisify(fs.readdir)(path.join(__dirname, '../apps'), { withFileTypes: true })
for (let dir of dirs) {
if (dir.isDirectory()) {
try {
await checkLink(dir.name)
} catch (e) {
msg += `${dir.name} -> ${(e as Error).message}\n`
}
}
}
if (!!msg) {
console.log(colors.red('Validation failed: \n' + msg))
process.exit(1)
}
console.log(colors.green('Validation passed!'))
process.exit(0)
})()
}else {
// run full validation if it's not a pull request
let validateLink = false
if (process.argv.length > 2) {
validateLink = process.argv[2] === 'link'
}
let appCount = 0
void (async () => {
let dirs = await promisify(fs.readdir)(path.join(__dirname, '../apps'), { withFileTypes: true })
for (let dir of dirs) {
if (dir.isDirectory()) {
try {
if (validateLink) {
await checkLink(dir.name)
} else {
await checkAPP(dir.name)
}
await checkAPP(dir.name)
} catch (e) {
throw new Error(`check ${dir.name} -> ${(e as Error).message}`)
}
Expand Down

0 comments on commit 92f9673

Please sign in to comment.