@@ -330,7 +330,7 @@ jobs:
330330
331331 Create-Or-Update-Issue :
332332 needs : [Complete]
333- if : ${{ needs.Complete.outputs.all-green != 'true' }}
333+ if : failure()
334334 runs-on : ubuntu-latest
335335 steps :
336336 - name : Download BVT Failures
@@ -350,6 +350,12 @@ jobs:
350350 const root = 'artifacts'
351351 const potential_issues = [];
352352
353+ // If root does not exist, exit silently
354+ if (!fs.existsSync(root)) {
355+ console.log('No artifacts found');
356+ process.exit(0);
357+ }
358+
353359 class Issue {
354360 constructor(title, description) {
355361 this.title = title;
@@ -359,52 +365,42 @@ jobs:
359365
360366 let run_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
361367
362- for (const env of fs.readdirSync(root)) {
363- // If env is not a directory, skip it.
364- if (!fs.statSync(path.join(root, env)).isDirectory()) {
365- continue;
366- }
367- for (const log of fs.readdirSync(path.join(root, env, 'logs', 'msquictest'))) {
368- // If log is not a directory, skip it.
369- if (!fs.statSync(path.join(root, env, 'logs', 'msquictest', log)).isDirectory()) {
370- continue;
371- }
372- for (const testcase of fs.readdirSync(path.join(root, env, 'logs', 'msquictest', log))) {
373- let title = `[CI - FAILURE]: ${env} / ${testcase} (msquictest)`
374- let new_issue = new Issue(title, run_url);
375- potential_issues.push(new_issue);
376- }
377- }
378- for (const log of fs.readdirSync(path.join(root, env, 'logs', 'msquicplatformtest'))) {
379- // If log is not a directory, skip it.
380- if (!fs.statSync(path.join(root, env, 'logs', 'msquicplatformtest', log)).isDirectory()) {
381- continue;
382- }
383- for (const testcase of fs.readdirSync(path.join(root, env, 'logs', 'msquicplatformtest', log))) {
384- let title = `[CI - FAILURE]: ${env} / ${testcase} (msquicplatformtest)`
385- let new_issue = new Issue(title, run_url);
386- potential_issues.push(new_issue);
368+ function find_issues(env, directory) {
369+ if (!fs.existsSync(path.join(root, env, 'logs', directory))) {
370+ return;
387371 }
388- }
389- for (const log of fs.readdirSync(path.join(root, env, 'logs', 'msquiccoretest'))) {
390- // If log is not a directory, skip it.
391- if (!fs.statSync(path.join(root, env, 'logs', 'msquiccoretest', log)).isDirectory()) {
392- continue;
372+ for (const log of fs.readdirSync(path.join(root, env, 'logs', directory))) {
373+ // If log is not a directory, skip it.
374+ if (!fs.statSync(path.join(root, env, 'logs', directory, log)).isDirectory()) {
375+ continue;
376+ }
377+ for (const testcase of fs.readdirSync(path.join(root, env, 'logs', directory, log))) {
378+ let title = `[CI - FAILURE]: ${env} / ${testcase} (${directory})`
379+ let new_issue = new Issue(title, run_url);
380+ potential_issues.push(new_issue);
381+ }
393382 }
394- for (const testcase of fs.readdirSync(path.join(root, env, 'logs', 'msquiccoretest', log))) {
395- let title = `[CI - FAILURE]: ${env} / ${testcase} (msquiccoretest)`
396- let new_issue = new Issue(title, run_url);
397- potential_issues.push(new_issue);
383+ }
384+
385+ for (const env of fs.readdirSync(root)) {
386+ // If env is not a directory, skip it.
387+ if (!fs.statSync(path.join(root, env)).isDirectory()) {
388+ continue;
398389 }
399- }
390+ find_issues(env, 'msquictest');
391+ find_issues(env, 'msquicplatformtest');
392+ find_issues(env, 'msquiccoretest');
400393 }
394+
401395 for (let Issue of potential_issues) {
402396 console.log(Issue.title);
403397 console.log(Issue.description);
404398 }
405399
406-
407400 // --- Prepare to File Issues ---
401+ let owner = context.repo.owner;
402+ let repo = context.repo.repo;
403+
408404 const dedup = new Map();
409405 for (const it of potential_issues) {
410406 if (!dedup.has(it.title)) dedup.set(it.title, it);
@@ -445,5 +441,5 @@ jobs:
445441 core.summary
446442 .addHeading('BVT Failure Issues')
447443 .addList(issuesToFile.map(i => i.title))
448- .addLink('Workflow run', runUrl )
444+ .addLink('Workflow run', run_url )
449445 .write();
0 commit comments