@@ -363,7 +363,7 @@ def before_all(context):
363363 select_apigee_base_url (env ), CPTS_FHIR_SUFFIX
364364 )
365365
366- get_function_export_name (context , env )
366+ get_function_export_name (context )
367367
368368 if PULL_REQUEST_ID and env != "LOCALHOST" :
369369 print (f"--- Using pull request id: '{ PULL_REQUEST_ID } '" )
@@ -396,22 +396,19 @@ def before_all(context):
396396 print ("PSU: " , context .psu_base_url )
397397
398398
399- def get_function_export_name (context , env ):
400- if PULL_REQUEST_ID is not None :
401- pull_request_id = PULL_REQUEST_ID .lower ()
402- context .espamCloudFormationStackName = EPSAM_STACK_NAME .replace (
403- "{{aws_pull_request_id}}" , f"-{ pull_request_id } "
404- )
405- context .espamSlackBotFunctionName = EPSAM_SLACKBOT_FUNCTION_EXPORT_NAME .replace (
406- "{{aws_pull_request_id}}" , f"-{ pull_request_id } "
407- )
399+ def get_function_export_name (context ):
400+ # only apply suffix if PR ID exists and starts with lowercase "pr-"
401+ if PULL_REQUEST_ID is not None and PULL_REQUEST_ID .startswith ("pr-" ):
402+ suffix = f"-{ PULL_REQUEST_ID } "
408403 else :
409- context .espamCloudFormationStackName = EPSAM_STACK_NAME .replace (
410- "{{aws_pull_request_id}}" , ""
411- )
412- context .espamSlackBotFunctionName = EPSAM_SLACKBOT_FUNCTION_EXPORT_NAME .replace (
413- "{{aws_pull_request_id}}" , ""
414- )
404+ suffix = ""
405+
406+ context .espamCloudFormationStackName = EPSAM_STACK_NAME .replace (
407+ "{{aws_pull_request_id}}" , suffix
408+ )
409+ context .espamSlackBotFunctionName = EPSAM_SLACKBOT_FUNCTION_EXPORT_NAME .replace (
410+ "{{aws_pull_request_id}}" , suffix
411+ )
415412
416413
417414def get_url_with_pr (context , env , product ):
0 commit comments