@@ -8,7 +8,7 @@ import {unified} from 'unified';
88/**
99 * Instructions:
1010 *
11- * 1. Run the following script: node scripts/getCommitsForTesting.js 2025-10-07 2025-10-18
11+ * 1. Run the following script: node scripts/getCommitsForTesting.mjs 2025-10-07 2025-10-18
1212 * 2. Go to output.csv, copy it to Google sheets, highlight the rows, go to "Data" in the toolbar -> split text to columns -> separator: comma
1313 */
1414
@@ -53,7 +53,7 @@ async function writeTestingCSV() {
5353 let content = info . data . body ;
5454 let testInstructions = escapeCSV ( extractTestInstructions ( content ) ) ;
5555
56- if ( testInstructions . length > 350 ) {
56+ if ( testInstructions . length > 300 ) {
5757 row . push ( 'See PR for testing instructions' ) ;
5858 } else {
5959 row . push ( testInstructions ) ;
@@ -62,16 +62,21 @@ async function writeTestingCSV() {
6262 // Add PR url to the row
6363 row . push ( info . data . html_url ) ;
6464
65- // Categorize commit into V3, RAC, S2, or other
66- // I feel like maybe we should use labels rather than looking at the PR title for this but we would need to get into the habit of doing that
67- if ( ( / \b s 2 \b / gi) . test ( title ) ) {
68- s2PRs . push ( row ) ;
69- } else if ( ( / \b r a c \b / gi) . test ( title ) ) {
70- racPRs . push ( row ) ;
71- } else if ( ( / \b v 3 \b / gi) . test ( title ) ) {
72- v3PRs . push ( row ) ;
73- } else {
65+ // Categorize commit into V3, RAC, S2, or other (utilizes labels on PR's to categorize)
66+ let labels = info . data . labels ;
67+ if ( labels . length === 0 ) {
7468 otherPRs . push ( row ) ;
69+ } else {
70+ for ( let label of labels ) {
71+ // eslint-disable-next-line max-depth
72+ if ( label . name === 'S2' ) {
73+ s2PRs . push ( row ) ;
74+ } else if ( label . name === 'RAC' ) {
75+ racPRs . push ( row ) ;
76+ } else if ( label . name === 'V3' ) {
77+ v3PRs . push ( row ) ;
78+ }
79+ }
7580 }
7681 }
7782 }
@@ -83,17 +88,17 @@ async function writeTestingCSV() {
8388 csvRows += v3 . join ( ) + '\n' ;
8489 }
8590
86- csvRows += '\nRainbow \n'
91+ csvRows += '\nRainbow \n' ;
8792 for ( let s2 of s2PRs ) {
8893 csvRows += s2 . join ( ) + '\n' ;
8994 }
9095
91- csvRows += '\nRAC \n'
96+ csvRows += '\nRAC \n' ;
9297 for ( let rac of racPRs ) {
9398 csvRows += rac . join ( ) + '\n' ;
9499 }
95100
96- csvRows += '\nOther \n'
101+ csvRows += '\nOther \n' ;
97102 for ( let other of otherPRs ) {
98103 csvRows += other . join ( ) + '\n' ;
99104 }
@@ -112,8 +117,8 @@ async function listCommits() {
112117 let end = new Date ( args . positionals [ 1 ] ) ;
113118
114119 if ( isNaN ( start . getTime ( ) ) || isNaN ( end . getTime ( ) ) ) {
115- console . error ( 'Please verify that your date is correctly formatted' )
116- process . exit ( 1 )
120+ console . error ( 'Please verify that your date is correctly formatted' ) ;
121+ process . exit ( 1 ) ;
117122 }
118123
119124 let startDate = new Date ( start ) . toISOString ( ) ;
@@ -146,7 +151,7 @@ function getHeadingText(node) {
146151 return node . children
147152 . map ( child => child . value || '' )
148153 . join ( '' )
149- . trim ( )
154+ . trim ( ) ;
150155}
151156
152157function extractTestInstructions ( contents ) {
@@ -182,7 +187,7 @@ function extractTestInstructions(contents) {
182187
183188 }
184189
185- return collected . map ( node => toString ( node ) ) . join ( '\n ' ) . trim ( ) ;
190+ return collected . map ( node => toString ( node ) ) . join ( ' ' ) . replace ( / \r \n / g , '\n' ) . replace ( / \s + / g , ' ') . trim ( ) ;
186191}
187192
188193
@@ -200,17 +205,3 @@ function escapeCSV(value) {
200205 // Wrap in quotes so commas/newlines don't break the cell
201206 return `"${ escaped } "` ;
202207}
203-
204- // We can bring this back if we start using the "needs testing" label
205- // function isReadyForTesting(labels){
206- // if (labels.length === 0) {
207- // return false;
208- // }
209- // for (let label of labels) {
210- // if (label.name === 'needs testing') {
211- // return true;
212- // }
213- // }
214-
215- // return false;
216- // }
0 commit comments