File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 id : set-matrix
2121 run : |
2222 matrix=$(node scripts/ci/generate-auto-bump-matrix.js)
23- echo "matrix<<EOF" >> $GITHUB_OUTPUT
24- echo "$matrix" >> $GITHUB_OUTPUT
25- echo "EOF" >> $GITHUB_OUTPUT
23+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
2624
2725 batch-dispatch :
2826 needs : prepare
4442 env :
4543 GH_TOKEN : ${{ secrets.RHDH_BOT_TOKEN }}
4644 run : |
47- echo "Triggering version bump for workspace ${{ matrix.workspace }}"
48- json_input='${{ toJson(matrix.workspace ) }}'
45+ echo "Triggering version bump for batch ${{ strategy.job-index }}"
46+ json_input='${{ toJson(matrix.batch ) }}'
4947 echo "Rendered json_input: $json_input"
5048 gh workflow run version-bump.yml \
5149 --ref main \
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import path from 'path';
1919
2020const workspacesDir = path . resolve ( 'workspaces' ) ;
2121
22- // Only include directories that contain a `.auto-version-bump` marker file
2322function getWorkspaceDirs ( ) {
2423 return fs . readdirSync ( workspacesDir ) . filter ( entry => {
2524 const dirPath = path . join ( workspacesDir , entry ) ;
@@ -29,9 +28,18 @@ function getWorkspaceDirs() {
2928 } ) ;
3029}
3130
32- const workspaces = getWorkspaceDirs ( ) . sort ( ) ;
31+ function batch ( array ) {
32+ const BATCH_SIZE = 10 ;
33+ const batchArray = [ ] ;
34+
35+ for ( let i = 0 ; i < array . length ; i += BATCH_SIZE ) {
36+ batchArray . push ( array . slice ( i , i + BATCH_SIZE ) ) ;
37+ }
3338
34- // Final matrix: one workspace per job
35- const matrix = workspaces . map ( workspace => ( { workspace } ) ) ;
39+ return batchArray ;
40+ }
41+
42+ const workspaces = getWorkspaceDirs ( ) . sort ( ) ;
43+ const batches = batch ( workspaces ) ;
3644
37- console . log ( JSON . stringify ( matrix ) ) ;
45+ console . log ( JSON . stringify ( { batch : batches } ) ) ;
You can’t perform that action at this time.
0 commit comments