@@ -27,8 +27,12 @@ const GITHUB_TAG_KEYS = [
2727 'github:ref-type' ,
2828 'github:actor' ,
2929 'github:head-ref' ,
30+ 'github:base-ref' ,
31+ 'github:pr-number' ,
3032 'github:run-id' ,
33+ 'github:run-attempt' ,
3134 'github:event' ,
35+ 'github:workflow' ,
3236 'github:repository' ,
3337 'github:clean' ,
3438] as const ;
@@ -42,7 +46,8 @@ function synthWithTags(context: Record<string, string> = {}): Template {
4246
4347 const githubTagKeys = [
4448 'sha' , 'ref' , 'ref-type' , 'actor' , 'head-ref' ,
45- 'run-id' , 'event' , 'repository' , 'clean' ,
49+ 'base-ref' , 'pr-number' , 'run-id' , 'run-attempt' ,
50+ 'event' , 'workflow' , 'repository' , 'clean' ,
4651 ] as const ;
4752
4853 for ( const key of githubTagKeys ) {
@@ -65,14 +70,18 @@ describe('github:* resource tags', () => {
6570 'github:ref-type' : 'branch' ,
6671 'github:actor' : 'scottschreckengaust' ,
6772 'github:head-ref' : '' ,
73+ 'github:base-ref' : 'main' ,
74+ 'github:pr-number' : '85' ,
6875 'github:run-id' : '12345678' ,
76+ 'github:run-attempt' : '1' ,
6977 'github:event' : 'push' ,
78+ 'github:workflow' : 'deploy.yml' ,
7079 'github:repository' : 'aws-samples/sample-autonomous-cloud-coding-agents' ,
7180 'github:clean' : 'true' ,
7281 } ) ;
7382 } ) ;
7483
75- test ( 'all 9 github:* tags default to "none" when no context is provided' , ( ) => {
84+ test ( 'all 13 github:* tags default to "none" when no context is provided' , ( ) => {
7685 const resources = templateWithDefaults . findResources ( 'AWS::DynamoDB::Table' ) ;
7786 const firstResource = Object . values ( resources ) [ 0 ] ;
7887 const tags : Array < { Key : string ; Value : string } > = firstResource ?. Properties ?. Tags ?? [ ] ;
@@ -94,8 +103,12 @@ describe('github:* resource tags', () => {
94103 expect ( tags . find ( t => t . Key === 'github:ref-type' ) ! . Value ) . toBe ( 'branch' ) ;
95104 expect ( tags . find ( t => t . Key === 'github:actor' ) ! . Value ) . toBe ( 'scottschreckengaust' ) ;
96105 expect ( tags . find ( t => t . Key === 'github:head-ref' ) ! . Value ) . toBe ( 'none' ) ;
106+ expect ( tags . find ( t => t . Key === 'github:base-ref' ) ! . Value ) . toBe ( 'main' ) ;
107+ expect ( tags . find ( t => t . Key === 'github:pr-number' ) ! . Value ) . toBe ( '85' ) ;
97108 expect ( tags . find ( t => t . Key === 'github:run-id' ) ! . Value ) . toBe ( '12345678' ) ;
109+ expect ( tags . find ( t => t . Key === 'github:run-attempt' ) ! . Value ) . toBe ( '1' ) ;
98110 expect ( tags . find ( t => t . Key === 'github:event' ) ! . Value ) . toBe ( 'push' ) ;
111+ expect ( tags . find ( t => t . Key === 'github:workflow' ) ! . Value ) . toBe ( 'deploy.yml' ) ;
99112 expect ( tags . find ( t => t . Key === 'github:repository' ) ! . Value ) . toBe ( 'aws-samples/sample-autonomous-cloud-coding-agents' ) ;
100113 expect ( tags . find ( t => t . Key === 'github:clean' ) ! . Value ) . toBe ( 'true' ) ;
101114 } ) ;
0 commit comments