1
1
import { ensureDirSync , readJsonSync , writeJsonSync } from 'fs-extra' ;
2
2
import { dirname , join } from 'path' ;
3
3
import { ReportData , ScopeData , TrendData } from './model' ;
4
- import { getScopeLabels , scrapeIssues } from './scrape-issues' ;
4
+ import { scrapeIssues } from './scrape-issues' ;
5
5
import { formatGhReport , getSlackMessageJson } from './format-slack-message' ;
6
6
import { setOutput } from '@actions/core' ;
7
7
import isCI from 'is-ci' ;
8
- import { readdirSync } from 'fs' ;
9
8
10
9
const CACHE_FILE = join ( __dirname , 'cached' , 'data.json' ) ;
11
10
@@ -15,12 +14,7 @@ async function main() {
15
14
oldData . collectedDate ? new Date ( oldData . collectedDate ) : undefined
16
15
) ;
17
16
const trendData = getTrendData ( currentData , oldData ) ;
18
- const formatted = formatGhReport (
19
- currentData ,
20
- trendData ,
21
- oldData ,
22
- getUnlabeledIssuesUrl ( await getScopeLabels ( ) )
23
- ) ;
17
+ const formatted = formatGhReport ( currentData , trendData , oldData ) ;
24
18
setOutput ( 'SLACK_MESSAGE' , getSlackMessageJson ( formatted ) ) ;
25
19
console . log ( formatted . replace ( / \< ( .* ) \| ( .* ) \> / g, '[$1]($0)' ) ) ;
26
20
saveCacheData ( currentData ) ;
@@ -47,7 +41,7 @@ function getTrendData(newData: ReportData, oldData: ReportData): TrendData {
47
41
scopes : scopeTrends as Record < string , ScopeData > ,
48
42
totalBugCount : newData . totalBugCount - oldData . totalBugCount ,
49
43
totalIssueCount : newData . totalIssueCount - oldData . totalIssueCount ,
50
- totalClosed : newData . totalClosed - oldData . totalClosed ?? 0 ,
44
+ totalClosed : newData . totalClosed - oldData . totalClosed ,
51
45
untriagedIssueCount :
52
46
newData . untriagedIssueCount - oldData . untriagedIssueCount ,
53
47
} ;
@@ -62,10 +56,8 @@ function saveCacheData(report: ReportData) {
62
56
63
57
function getOldData ( ) : ReportData {
64
58
try {
65
- console . log ( 'DIR CONTENTS:' , readdirSync ( dirname ( CACHE_FILE ) ) ) ;
66
59
return readJsonSync ( CACHE_FILE ) ;
67
60
} catch ( e ) {
68
- console . log ( e ) ;
69
61
return {
70
62
scopes : { } ,
71
63
totalBugCount : 0 ,
@@ -75,10 +67,3 @@ function getOldData(): ReportData {
75
67
} ;
76
68
}
77
69
}
78
-
79
- function getUnlabeledIssuesUrl ( scopeLabels : string [ ] ) {
80
- const labelFilters = scopeLabels . map ( ( s ) => `-label:"${ s } "` ) ;
81
- return `https://github.com/nrwl/nx/issues/?q=is%3Aopen+is%3Aissue+sort%3Aupdated-desc+${ encodeURIComponent (
82
- labelFilters . join ( ' ' )
83
- ) } `;
84
- }
0 commit comments