1- import { execSync } from 'child_process '
2- import { join } from 'path '
3- import { getInput , debug , setFailed , setOutput } from '@actions/core '
1+ import { debug , getInput , setFailed , setOutput } from '@actions/core '
2+ import { execSync } from 'child_process '
3+ import { join } from 'path '
44
55const run = async ( ) : Promise < void > => {
66 try {
77 // Get Inputs
8- const prefix = getInput ( 'prefix' , { required : false } )
9- const extractPrefix = getInput ( 'extract-prefix' , { required : false } )
10- const from = getInput ( 'from' , { required : false } )
11- const to = getInput ( 'to' , { required : false } )
12- const workingDirectory = getInput ( 'working-directory' , { required : false } )
8+ const prefix = getInput ( 'prefix' , { required : false } )
9+ const extractPrefix = getInput ( 'extract-prefix' , { required : false } )
10+ const from = getInput ( 'from' , { required : false } )
11+ const to = getInput ( 'to' , { required : false } )
12+ const workingDirectory = getInput ( 'working-directory' , { required : false } )
1313
14- debug ( `Inputs: ${ JSON . stringify ( { prefix, from, to, workingDirectory } ) } ` )
14+ debug ( `Inputs: ${ JSON . stringify ( { prefix, from, to, workingDirectory} ) } ` )
1515
1616 const json = execSync (
17- `npx turbo run build ${ from || to ? `--filter="[${ from } ...${ to } ]"` : '' } --dry-run=json` ,
17+ `npx turbo run build ${
18+ from || to ? `--filter="[${ from } ...${ to } ]"` : ''
19+ } --dry-run=json`,
1820 {
1921 cwd : join ( process . cwd ( ) , workingDirectory ) ,
20- encoding : 'utf-8' ,
21- } ,
22+ encoding : 'utf-8'
23+ }
2224 )
2325
2426 debug ( `Output from Turborepo: ${ json } ` )
2527
2628 const parsedOutput = JSON . parse ( json )
27- const changedPackages = parsedOutput . packages . filter (
28- ( p : string ) => ! prefix || p . startsWith ( prefix )
29- ) . map ( ( p : string ) => extractPrefix ? p . replace ( prefix , "" ) : p ) ;
29+ const changedPackages = parsedOutput . packages
30+ . filter ( ( p : string ) => ! prefix || p . startsWith ( prefix ) )
31+ . map ( ( p : string ) => ( extractPrefix ? p . replace ( prefix , '' ) : p ) )
3032
3133 setOutput ( 'changed' , changedPackages )
3234 } catch ( error ) {
@@ -38,4 +40,4 @@ const run = async (): Promise<void> => {
3840 }
3941}
4042
41- void run ( )
43+ void run ( )
0 commit comments