@@ -55,8 +55,6 @@ export type State = {
55
55
56
56
export class Action {
57
57
async pre ( state : State ) : Promise < State > {
58
- console . log ( '!!! env' , JSON . stringify ( process . env , null , 2 ) ) ;
59
- console . log ( '!!! payload' , JSON . stringify ( context . payload , null , 2 ) ) ;
60
58
state . stage = this . stage ;
61
59
62
60
if ( boolean ( getInput ( 'destroy' ) || 'false' ) === true ) {
@@ -274,27 +272,21 @@ export class Action {
274
272
}
275
273
276
274
get stage ( ) : string {
277
- const [ , branchType , branchId ] = GITHUB_REF ?. split ( '/' ) || [ ] ;
278
- debug ( `GITHUB_REF: ${ GITHUB_REF } ` ) ;
279
- debug ( `GITHUB_BASE_REF: ${ GITHUB_BASE_REF } ` ) ;
280
- debug ( `GITHUB_HEAD_REF: ${ GITHUB_HEAD_REF } ` ) ;
281
- debug ( `Branch Type: ${ branchType } ` ) ;
282
- debug ( `Branch ID: ${ branchId } ` ) ;
283
- debug ( `PR Number: ${ this . prNumber } ` ) ;
284
-
285
- if ( ! branchId ) {
275
+ const branchName = GITHUB_REF ?. split ( '/' ) . slice ( 2 ) . join ( '/' ) || '' ;
276
+ debug ( `Branch Name: ${ branchName } ` ) ;
277
+
278
+ if ( ! branchName ) {
286
279
throw new Error ( 'Unable to determine branch from GITHUB_REF' ) ;
287
280
}
288
281
289
- let deploymentStage = branchId ;
282
+ let deploymentStage = branchName . replaceAll ( '/' , '-' ) ;
283
+
290
284
if ( this . prNumber ) {
291
285
if ( ! GITHUB_BASE_REF ) {
292
286
throw new Error ( 'Unable to determine base ref from GITHUB_BASE_REF' ) ;
293
287
}
294
288
295
289
const normalizedBaseRef = GITHUB_BASE_REF . replaceAll ( '/' , '-' ) ;
296
- debug ( 'Normalized Base Ref: ' + normalizedBaseRef ) ;
297
-
298
290
deploymentStage = `${ normalizedBaseRef } -pr-${ this . prNumber } ` ;
299
291
}
300
292
0 commit comments