@@ -404,6 +441,8 @@ async function validateAllInternalLinks(): Promise<void> {
...
@@ -404,6 +441,8 @@ async function validateAllInternalLinks(): Promise<void> {
leterrorComment=
leterrorComment=
'Hi there :wave:\n\nIt looks like this PR introduces broken links to the docs, please take a moment to fix them before merging:\n\n| :heavy_multiplication_x: Broken link | :page_facing_up: File | \n| ----------- | ----------- | \n'
'Hi there :wave:\n\nIt looks like this PR introduces broken links to the docs, please take a moment to fix them before merging:\n\n| :heavy_multiplication_x: Broken link | :page_facing_up: File | \n| ----------- | ----------- | \n'
leterrorsExist=false
allErrors.forEach((errors)=>{
allErrors.forEach((errors)=>{
const{
const{
doc:{path:docPath},
doc:{path:docPath},
...
@@ -414,24 +453,28 @@ async function validateAllInternalLinks(): Promise<void> {
...
@@ -414,24 +453,28 @@ async function validateAllInternalLinks(): Promise<void> {
}=errors
}=errors
if(brokenLinks.length>0){
if(brokenLinks.length>0){
errorsExist=true
brokenLinks.forEach((link)=>{
brokenLinks.forEach((link)=>{
errorComment+=formatTableRow(link,docPath)
errorComment+=formatTableRow(link,docPath)
})
})
}
}
if(brokenHashes.length>0){
if(brokenHashes.length>0){
errorsExist=true
brokenHashes.forEach((hash)=>{
brokenHashes.forEach((hash)=>{
errorComment+=formatTableRow(hash,docPath)
errorComment+=formatTableRow(hash,docPath)
})
})
}
}
if(brokenSourceLinks.length>0){
if(brokenSourceLinks.length>0){
errorsExist=true
brokenSourceLinks.forEach((link)=>{
brokenSourceLinks.forEach((link)=>{
errorComment+=formatTableRow(link,docPath)
errorComment+=formatTableRow(link,docPath)
})
})
}
}
if(brokenRelatedLinks.length>0){
if(brokenRelatedLinks.length>0){
errorsExist=true
brokenRelatedLinks.forEach((link)=>{
brokenRelatedLinks.forEach((link)=>{
errorComment+=formatTableRow(link,docPath)
errorComment+=formatTableRow(link,docPath)
})
})
...
@@ -440,14 +483,6 @@ async function validateAllInternalLinks(): Promise<void> {
...
@@ -440,14 +483,6 @@ async function validateAllInternalLinks(): Promise<void> {
errorComment+='\nThank you :pray:'
errorComment+='\nThank you :pray:'
consterrorsExist=allErrors.some(
(errors)=>
errors.brokenLinks.length>0||
errors.brokenHashes.length>0||
errors.brokenSourceLinks.length>0||
errors.brokenRelatedLinks.length>0
)
constbotComment=awaitfindBotComment()
constbotComment=awaitfindBotComment()
letcommentUrl
letcommentUrl
...
@@ -457,7 +492,7 @@ async function validateAllInternalLinks(): Promise<void> {
...
@@ -457,7 +492,7 @@ async function validateAllInternalLinks(): Promise<void> {
if(botComment){
if(botComment){
commentUrl=awaitupdateComment(comment,botComment)
commentUrl=awaitupdateComment(comment,botComment)
}else{
}else{
commentUrl=awaitcreateComment(comment)
commentUrl=awaitcreateComment(comment,allErrors)
}
}
}else{
}else{
constcomment=`${COMMENT_TAG}\nAll broken links are now fixed, thank you!`
constcomment=`${COMMENT_TAG}\nAll broken links are now fixed, thank you!`