Skip to content

Commit

Permalink
Merge pull request #7112 from tech-conferences/addLinkToValidLocatioins
Browse files Browse the repository at this point in the history
Add link to valid locations in PR
  • Loading branch information
cgrail authored Aug 8, 2024
2 parents 385df0b + 3849b70 commit e968f2a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/utils/logTestResult.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import chalk from 'chalk';
import commentPullRequest from './commentPullRequest';
import { sortBy, uniqWith, isEqual } from 'lodash';
import { TestResult } from './TestResult';
import { isEqual, sortBy, uniqWith } from 'lodash';
import { Conference } from './Conference';
import { DuplicateType } from './DuplicateType';
import { ErrorDetail } from './ErrorDetail';
import { MergedConference } from './MergedConference';
import { TestResult } from './TestResult';
import commentPullRequest from './commentPullRequest';
import findLineNumber from './findLineNumber';
import { Conference } from './Conference';
import { DuplicateType } from './DuplicateType';
import getDuplicatePr from './getDuplicatePr';
import * as github from '@actions/github';
import getPrBranchUrl from './getPrBranchUrl';

export default async function logTestResult(testResult: TestResult) {
const allErrors: ErrorDetail[] = [];
const token = process.env['GITHUB_TOKEN'];
const prBranchUrl = await getPrBranchUrl(token);
for (const year of Object.keys(testResult.errors)) {
const errorsOfYear: ErrorDetail[] = [];
process.stdout.write(chalk.gray(`${year}: `));
Expand All @@ -22,6 +22,9 @@ export default async function logTestResult(testResult: TestResult) {
const errors = testResult.errors[year][topic];
if (errors.length >= 1) {
for (const error of errors) {
if (prBranchUrl) {
error.message.replace('scripts/config/validLocations.ts', `[scripts/config/validLocations.ts](${prBranchUrl}scripts/config/validLocations.ts)`);
}
errorsOfYear.push(error);
allErrors.push(error);
}
Expand All @@ -43,7 +46,6 @@ export default async function logTestResult(testResult: TestResult) {
}

const duplicateErrorMessages: string[] = [];
const prBranchUrl = await getPrBranchUrl(token);
function logDifferences(conference: Conference, duplicate: Conference) {
for (const field of Object.keys(conference)) {
if (field == 'startDateParsed' || field == 'stacks' || field == 'endDateParsed' || field == 'cfpEndDateParsed') {
Expand Down

0 comments on commit e968f2a

Please sign in to comment.