@@ -9,17 +9,24 @@ import { runTestForTags } from "./runTestForTags.mjs";
9
9
const __dirname = getDirName ( ) ;
10
10
11
11
const execOptions = { ...process , cwd : __dirname , encoding : "utf-8" } ;
12
- const commitMessage = execSync ( `git show -s --format=%s` , execOptions ) ;
13
- const prefix = commitMessage . split ( ":" ) [ 0 ] ;
14
- const scope = prefix . substring ( prefix . indexOf ( "(" ) + 1 , prefix . indexOf ( ")" ) ) ;
15
- console . info ( `Updated scope: ${ scope } ` ) ;
12
+ const commitsSinceOriginHead = execSync ( `git log --oneline origin/main..HEAD --format=%s` , execOptions ) . split ( "\n" ) ;
16
13
17
- if ( ! scope ) {
18
- console . info ( `Couldn't find scope in commit message '${ commitMessage } '` ) ;
14
+ const updatedClients = new Set ( ) ;
15
+ for ( const commitMessage of commitsSinceOriginHead ) {
16
+ const prefix = commitMessage . split ( ":" ) [ 0 ] ;
17
+ const scope = prefix . substring ( prefix . indexOf ( "(" ) + 1 , prefix . indexOf ( ")" ) ) ;
18
+ if ( scope && scope . startsWith ( "client-" ) ) {
19
+ updatedClients . add ( `@aws-sdk/${ scope } ` ) ;
20
+ }
21
+ }
22
+ console . info ( `Updated packages: ${ updatedClients } ` ) ;
23
+
24
+ if ( updatedClients . size === 0 ) {
25
+ console . info ( `Couldn't find clients in commit messages:\n '${ commitsSinceOriginHead . join ( "\n" ) } '` ) ;
19
26
process . exit ( 1 ) ;
20
27
}
21
28
22
29
const allTags = getAllTags ( ) ;
23
- const changedPackageTags = getPackageTags ( [ `@aws-sdk/ ${ scope } ` ] ) ;
30
+ const changedPackageTags = getPackageTags ( [ ... updatedClients ] ) ;
24
31
const tagsToTest = changedPackageTags . filter ( ( tag ) => allTags . includes ( tag ) ) ;
25
32
runTestForTags ( tagsToTest ) ;
0 commit comments