Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-workflow-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
REPOSITORY_NAME: Azure-Samples/azd-ai-starter

- name: print result
run: cat ${{ steps.validation3.outputs.resultFile }}
run: cat ${{ steps.validation3.outputs.resultFile }}
16 changes: 14 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,22 @@ runs:
run: |
if [ -f "${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep" ]; then
# Check if targetScope is set to 'subscription' or 'resourceGroup'. The sample sentence in bicep is: targetScope = 'subscription'
targetScope=$(grep -oP "targetScope\s*=\s*['\"]\K[^'\"]+" ${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep)
targetScope=$(grep -oP "targetScope\s*=\s*['\"]\K[^'\"]+" "${{ steps.reform_path.outputs.workingDirectory }}/infra/main.bicep" 2>/dev/null || echo "")
echo "targetScope: $targetScope"
echo "targetScope=$targetScope" >> $GITHUB_ENV
if [ "$targetScope" == "subscription" ]; then
echo "targetScope is set to 'subscription' in main.bicep"
# Add the targetScope to the env variables
elif [ "$targetScope" == "resourceGroup" ]; then
echo "targetScope is set to 'resourceGroup' in main.bicep"
else
echo "targetScope is not set to 'subscription' or 'resourceGroup' in main.bicep"
echo "targetScope is not set to 'subscription' or 'resourceGroup' in main.bicep, set to 'resourceGroup' by default"
targetScope="resourceGroup"
echo "targetScope=$targetScope" >> $GITHUB_ENV
fi
fi
shell: bash
continue-on-error: true

- name: Set azure resource group name in env
id: set_resource_group
Expand Down Expand Up @@ -402,6 +406,14 @@ runs:
CREATE_ROLE_FOR_USER: false
AZURE_PRINCIPAL_TYPE: "ServicePrincipal"

- name: Azure CLI script
id: delete_resource_group
if : ${{ inputs.validateAzd == 'true' && env.targetScope == 'resourceGroup' }}
run: |
az group delete --resource-group ${{ env.AZURE_RESOURCE_GROUP }} -y || echo "Warning: Failed to delete resource group ${AZURE_RESOURCE_GROUP}, continuing..."
shell: bash
continue-on-error: true

- id: set_output
run: |
if [[ ${{ inputs.useDevContainer }} == 'true' ]]; then
Expand Down