Skip to content

Commit

Permalink
πŸ› Bug fix: check links test (#26739)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwhatson committed Feb 20, 2020
1 parent 911661b commit f56cdd4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build-system/tasks/check-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {linkCheckGlobs} = require('../test-configs/config');
const {maybeUpdatePackages} = require('./update-packages');

const LARGE_REFACTOR_THRESHOLD = 20;
const GITHUB_BASE_PATH = 'https://github.com/ampproject/amphtml/blob/master/';

let filesIntroducedByPr;

Expand Down Expand Up @@ -135,8 +136,14 @@ function checkLinksInFile(file) {
let containsDeadLinks = false;
for (const {link, status, statusCode} of results) {
// Skip links to files that were introduced by the PR.
if (isLinkToFileIntroducedByPR(link)) {
continue;
if (isLinkToFileIntroducedByPR(link) && status == 'dead') {
// Log links with the correct github base as alive, otherwise flag deadlinks.
const isValid = filesIntroducedByPr.some(file => {
return link === GITHUB_BASE_PATH + file;
});
if (isValid) {
status = 'alive';
}
}
switch (status) {
case 'alive':
Expand Down

0 comments on commit f56cdd4

Please sign in to comment.