11name : Deploy-Test-Cleanup (Parameterized)
22on :
3+ pull_request :
4+ branches :
5+ - main
6+ workflow_run :
7+ workflows : ["Build Docker and Optional Push"]
8+ types :
9+ - completed
10+ branches :
11+ - main
12+ - dev
13+ - demo
314 workflow_dispatch :
415 inputs :
516 run_e2e_tests :
3748 required : false
3849 default : false
3950 type : boolean
51+ schedule :
52+ - cron : " 0 6,18 * * *" # Runs at 6:00 AM and 6:00 PM GMT
4053
4154
4255
4356env :
4457 GPT_MIN_CAPACITY : 150
4558 TEXT_EMBEDDING_MIN_CAPACITY : 80
4659 BRANCH_NAME : ${{ github.event.workflow_run.head_branch || github.head_ref || github.ref_name }}
47- WAF_ENABLED : ${{ github.event.inputs.waf_enabled || false }}
48- EXP : ${{ github.event.inputs.EXP || false }}
49- CLEANUP_RESOURCES : ${{ github.event.inputs.cleanup_resources || true }}
50- RUN_E2E_TESTS : ${{ github.event.inputs.run_e2e_tests || true }}
51- BUILD_DOCKER_IMAGE : ${{ github.event.inputs.build_docker_image || false }}
60+ # For automatic triggers (pull_request, workflow_run, schedule): force Non-WAF + Non-EXP
61+ # For manual dispatch: use input values or defaults
62+ WAF_ENABLED : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.waf_enabled || false) || false }}
63+ EXP : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.EXP || false) || false }}
64+ CLEANUP_RESOURCES : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.cleanup_resources || true) || true }}
65+ RUN_E2E_TESTS : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.run_e2e_tests || true) || true }}
66+ BUILD_DOCKER_IMAGE : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build_docker_image || false) || false }}
5267
5368jobs :
5469 deploy :
@@ -60,11 +75,34 @@ jobs:
6075 AZURE_LOCATION : ${{ steps.set_region.outputs.AZURE_LOCATION }}
6176 IMAGE_TAG : ${{ steps.generate_docker_tag.outputs.IMAGE_TAG }}
6277 env :
63- WAF_ENABLED : ${{ github.event.inputs.waf_enabled || true }}
64- EXP : ${{ github.event.inputs.EXP || false }}
65- CLEANUP_RESOURCES : ${{ github.event.inputs.cleanup_resources || true }}
78+ # For automatic triggers: force Non-WAF + Non-EXP, for manual dispatch: use inputs
79+ WAF_ENABLED : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.waf_enabled || false) || false }}
80+ EXP : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.EXP || false) || false }}
81+ CLEANUP_RESOURCES : ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.cleanup_resources || true) || true }}
6682
6783 steps :
84+ - name : Display Workflow Configuration
85+ run : |
86+ echo "🚀 ==================================="
87+ echo "📋 WORKFLOW CONFIGURATION SUMMARY"
88+ echo "🚀 ==================================="
89+ echo "Trigger Type: ${{ github.event_name }}"
90+ echo "Branch: ${{ env.BRANCH_NAME }}"
91+ echo ""
92+ echo "Configuration Settings:"
93+ echo " • WAF Enabled: ${{ env.WAF_ENABLED }}"
94+ echo " • EXP Enabled: ${{ env.EXP }}"
95+ echo " • Run E2E Tests: ${{ env.RUN_E2E_TESTS }}"
96+ echo " • Cleanup Resources: ${{ env.CLEANUP_RESOURCES }}"
97+ echo " • Build Docker Image: ${{ env.BUILD_DOCKER_IMAGE }}"
98+ echo ""
99+ if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
100+ echo "ℹ️ Automatic Trigger: Using Non-WAF + Non-EXP configuration"
101+ else
102+ echo "ℹ️ Manual Trigger: Using user-specified configuration"
103+ fi
104+ echo "🚀 ==================================="
105+
68106 - name : Validate EXP Configuration
69107 run : |
70108 echo "🔍 Validating EXP configuration..."
@@ -453,15 +491,17 @@ jobs:
453491 echo "Logged out from Azure."
454492
455493 e2e-test :
456- if : github.event.inputs.run_e2e_tests == true || github.event.inputs.run_e2e_tests == null
494+ # Run e2e tests for automatic triggers or when manually enabled
495+ if : github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == true || github.event.inputs.run_e2e_tests == null
457496 needs : deploy
458497 uses : ./.github/workflows/test-automation.yml
459498 with :
460499 DOCGEN_URL : ${{ needs.deploy.outputs.WEBAPP_URL }}
461500 secrets : inherit
462501
463502 cleanup-deployment :
464- if : always() && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && (github.event.inputs.cleanup_resources == true || github.event.inputs.cleanup_resources == null)
503+ # Cleanup for automatic triggers or when manually enabled
504+ if : always() && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && (github.event_name != 'workflow_dispatch' || github.event.inputs.cleanup_resources == true || github.event.inputs.cleanup_resources == null)
465505 needs : [deploy]
466506 runs-on : ubuntu-latest
467507 env :
0 commit comments