Skip to content

Commit b6ab9fd

Browse files
Merge branch 'main' into dev
2 parents b592405 + 2aa15c0 commit b6ab9fd

File tree

9 files changed

+245
-39
lines changed

9 files changed

+245
-39
lines changed

.github/dependabot.yml

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,56 @@
11
version: 2
22
updates:
3-
# GitHub Actions dependencies
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
6-
schedule:
7-
interval: "monthly"
8-
commit-message:
9-
prefix: "build"
10-
target-branch: "dependabotchanges"
11-
open-pull-requests-limit: 100
3+
# GitHub Actions dependencies (grouped)
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
commit-message:
9+
prefix: "build"
10+
target-branch: "dependabotchanges"
11+
open-pull-requests-limit: 10
12+
groups:
13+
all-actions:
14+
patterns:
15+
- "*"
1216

13-
- package-ecosystem: "pip"
14-
directory: "/src/backend"
15-
schedule:
16-
interval: "monthly"
17-
commit-message:
18-
prefix: "build"
19-
target-branch: "dependabotchanges"
20-
open-pull-requests-limit: 100
17+
# Python dependencies (grouped)
18+
- package-ecosystem: "pip"
19+
directory: "/src/backend"
20+
schedule:
21+
interval: "monthly"
22+
commit-message:
23+
prefix: "build"
24+
target-branch: "dependabotchanges"
25+
open-pull-requests-limit: 10
26+
groups:
27+
all-backend-deps:
28+
patterns:
29+
- "*"
2130

22-
- package-ecosystem: "pip"
23-
directory: "/src/frontend"
24-
schedule:
25-
interval: "monthly"
26-
commit-message:
27-
prefix: "build"
28-
target-branch: "dependabotchanges"
29-
open-pull-requests-limit: 100
31+
- package-ecosystem: "pip"
32+
directory: "/src/frontend"
33+
schedule:
34+
interval: "monthly"
35+
commit-message:
36+
prefix: "build"
37+
target-branch: "dependabotchanges"
38+
open-pull-requests-limit: 10
39+
groups:
40+
all-backend-deps:
41+
patterns:
42+
- "*"
3043

31-
- package-ecosystem: "npm"
32-
directory: "/src/frontend"
33-
schedule:
34-
interval: "monthly"
35-
commit-message:
36-
prefix: "build"
37-
target-branch: "dependabotchanges"
38-
open-pull-requests-limit: 100
44+
# npm dependencies (grouped)
45+
- package-ecosystem: "npm"
46+
directory: "/src/frontend"
47+
schedule:
48+
interval: "monthly"
49+
commit-message:
50+
prefix: "build"
51+
target-branch: "dependabotchanges"
52+
open-pull-requests-limit: 10
53+
groups:
54+
all-frontend-deps:
55+
patterns:
56+
- "*"

.github/workflows/build-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
type: boolean
2424
secrets:
2525
DOCKER_PASSWORD:
26-
required: true
26+
required: false
2727

2828
jobs:
2929
docker-build:
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# ------------------------------------------------------------------------------
2+
# Scheduled Dependabot PRs Auto-Merge Workflow
3+
#
4+
# Purpose:
5+
# - Automatically detect, rebase (if needed), and merge Dependabot PRs targeting
6+
# the `dependabotchanges` branch, supporting different merge strategies.
7+
#
8+
# Features:
9+
# ✅ Filters PRs authored by Dependabot and targets the specific base branch
10+
# ✅ Rebases PRs with conflicts and auto-resolves using "prefer-theirs" strategy
11+
# ✅ Attempts all three merge strategies: merge, squash, rebase (first success wins)
12+
# ✅ Handles errors gracefully, logs clearly
13+
#
14+
# Triggers:
15+
# - Scheduled daily run (midnight UTC)
16+
# - Manual trigger (via GitHub UI)
17+
#
18+
# Required Permissions:
19+
# - contents: write
20+
# - pull-requests: write
21+
# ------------------------------------------------------------------------------
22+
23+
name: Scheduled Dependabot PRs Auto-Merge
24+
25+
on:
26+
schedule:
27+
- cron: '0 0 * * *' # Runs once a day at midnight UTC
28+
workflow_dispatch:
29+
30+
permissions:
31+
contents: write
32+
pull-requests: write
33+
34+
jobs:
35+
merge-dependabot:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
- name: Install GitHub CLI
42+
run: |
43+
sudo apt update
44+
sudo apt install -y gh
45+
- name: Fetch & Filter Dependabot PRs
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
echo "🔍 Fetching all Dependabot PRs targeting 'dependabotchanges'..."
50+
> matched_prs.txt
51+
pr_batch=$(gh pr list --state open --json number,title,author,baseRefName,url \
52+
--jq '.[] | "\(.number)|\(.title)|\(.author.login)|\(.baseRefName)|\(.url)"')
53+
while IFS='|' read -r number title author base url; do
54+
author=$(echo "$author" | xargs)
55+
base=$(echo "$base" | xargs)
56+
if [[ "$author" == "app/dependabot" && "$base" == "dependabotchanges" ]]; then
57+
echo "$url" >> matched_prs.txt
58+
echo "✅ Matched PR #$number - $title"
59+
else
60+
echo "❌ Skipped PR #$number - $title (Author: $author, Base: $base)"
61+
fi
62+
done <<< "$pr_batch"
63+
echo "👉 Matched PRs:"
64+
cat matched_prs.txt || echo "None"
65+
- name: Rebase PR if Conflicts Exist
66+
if: success()
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
run: |
70+
if [[ ! -s matched_prs.txt ]]; then
71+
echo "⚠️ No matching PRs to process."
72+
exit 0
73+
fi
74+
while IFS= read -r pr_url; do
75+
pr_number=$(basename "$pr_url")
76+
echo "🔁 Checking PR #$pr_number for conflicts..."
77+
mergeable=$(gh pr view "$pr_number" --json mergeable --jq '.mergeable')
78+
if [[ "$mergeable" == "CONFLICTING" ]]; then
79+
echo "⚠️ Merge conflicts detected. Performing manual rebase for PR #$pr_number..."
80+
head_branch=$(gh pr view "$pr_number" --json headRefName --jq '.headRefName')
81+
base_branch=$(gh pr view "$pr_number" --json baseRefName --jq '.baseRefName')
82+
git fetch origin "$base_branch":"$base_branch"
83+
git fetch origin "$head_branch":"$head_branch"
84+
git checkout "$head_branch"
85+
git config user.name "github-actions"
86+
git config user.email "[email protected]"
87+
# Attempt rebase with 'theirs' strategy
88+
if git rebase --strategy=recursive -X theirs "$base_branch"; then
89+
echo "✅ Rebase successful. Pushing..."
90+
git push origin "$head_branch" --force
91+
else
92+
echo "❌ Rebase failed. Aborting..."
93+
git rebase --abort || true
94+
fi
95+
else
96+
echo "✅ PR #$pr_number is mergeable. Skipping rebase."
97+
fi
98+
done < matched_prs.txt
99+
100+
- name: Auto-Merge PRs using available strategy
101+
if: success()
102+
env:
103+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
run: |
105+
if [[ ! -s matched_prs.txt ]]; then
106+
echo "⚠️ No matching PRs to process."
107+
exit 0
108+
fi
109+
while IFS= read -r pr_url; do
110+
pr_number=$(basename "$pr_url")
111+
echo "🔍 Checking mergeability for PR #$pr_number"
112+
attempt=0
113+
max_attempts=8
114+
mergeable=""
115+
sleep 5 # Let GitHub calculate mergeable status
116+
while [[ $attempt -lt $max_attempts ]]; do
117+
mergeable=$(gh pr view "$pr_number" --json mergeable --jq '.mergeable' 2>/dev/null || echo "UNKNOWN")
118+
echo "🔁 Attempt $((attempt+1))/$max_attempts: mergeable=$mergeable"
119+
if [[ "$mergeable" == "MERGEABLE" ]]; then
120+
success=0
121+
for strategy in rebase squash merge; do
122+
echo "🚀 Trying to auto-merge PR #$pr_number using '$strategy' strategy..."
123+
set -x
124+
merge_output=$(gh pr merge --auto --"$strategy" "$pr_url" 2>&1)
125+
merge_status=$?
126+
set +x
127+
echo "$merge_output"
128+
if [[ $merge_status -eq 0 ]]; then
129+
echo "✅ Auto-merge succeeded using '$strategy'."
130+
success=1
131+
break
132+
else
133+
echo "❌ Auto-merge failed using '$strategy'. Trying next strategy..."
134+
fi
135+
done
136+
if [[ $success -eq 0 ]]; then
137+
echo "❌ All merge strategies failed for PR #$pr_number"
138+
fi
139+
break
140+
elif [[ "$mergeable" == "CONFLICTING" ]]; then
141+
echo "❌ Cannot merge due to conflicts. Skipping PR #$pr_number"
142+
break
143+
else
144+
echo "🕒 Waiting for GitHub to determine mergeable status..."
145+
sleep 15
146+
fi
147+
((attempt++))
148+
done
149+
if [[ "$mergeable" != "MERGEABLE" && "$mergeable" != "CONFLICTING" ]]; then
150+
echo "❌ Mergeability undetermined after $max_attempts attempts. Skipping PR #$pr_number"
151+
fi
152+
done < matched_prs.txt || echo "⚠️ Completed loop with some errors, but continuing gracefully."

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Check out similar solution accelerators
184184
| Solution Accelerator | Description |
185185
|---|---|
186186
| [Documen Knowledge Mining](https://github.com/microsoft/Document-Knowledge-Mining-Solution-Accelerator) | Extract structured information from unstructured documents using AI |
187-
| [Multi Agent Custom Automation Engine Solution Acceleratorr](https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator/tree/main) | An AI-driven orchestration system that manages a group of AI agents to accomplish tasks based on user input |
187+
| [Multi Agent Custom Automation Engine Solution Accelerator](https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator/tree/main) | An AI-driven orchestration system that manages a group of AI agents to accomplish tasks based on user input |
188188
| [Conversation Knowledge Mining](https://github.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator) | Enable organizations to derive insights from volumes of conversational data using generative AI |
189189

190190
<br/>
@@ -210,4 +210,4 @@ You acknowledge that the Software and Microsoft Products and Services (1) are no
210210

211211
You acknowledge the Software is not subject to SOC 1 and SOC 2 compliance audits. No Microsoft technology, nor any of its component technologies, including the Software, is intended or made available as a substitute for the professional advice, opinion, or judgement of a certified financial services professional. Do not use the Software to replace, substitute, or provide professional financial advice or judgment.
212212

213-
BY ACCESSING OR USING THE SOFTWARE, YOU ACKNOWLEDGE THAT THE SOFTWARE IS NOT DESIGNED OR INTENDED TO SUPPORT ANY USE IN WHICH A SERVICE INTERRUPTION, DEFECT, ERROR, OR OTHER FAILURE OF THE SOFTWARE COULD RESULT IN THE DEATH OR SERIOUS BODILY INJURY OF ANY PERSON OR IN PHYSICAL OR ENVIRONMENTAL DAMAGE (COLLECTIVELY, "HIGH-RISK USE"), AND THAT YOU WILL ENSURE THAT, IN THE EVENT OF ANY INTERRUPTION, DEFECT, ERROR, OR OTHER FAILURE OF THE SOFTWARE, THE SAFETY OF PEOPLE, PROPERTY, AND THE ENVIRONMENT ARE NOT REDUCED BELOW A LEVEL THAT IS REASONABLY, APPROPRIATE, AND LEGAL, WHETHER IN GENERAL OR IN A SPECIFIC INDUSTRY. BY ACCESSING THE SOFTWARE, YOU FURTHER ACKNOWLEDGE THAT YOUR HIGH-RISK USE OF THE SOFTWARE IS AT YOUR OWN RISK.
213+
BY ACCESSING OR USING THE SOFTWARE, YOU ACKNOWLEDGE THAT THE SOFTWARE IS NOT DESIGNED OR INTENDED TO SUPPORT ANY USE IN WHICH A SERVICE INTERRUPTION, DEFECT, ERROR, OR OTHER FAILURE OF THE SOFTWARE COULD RESULT IN THE DEATH OR SERIOUS BODILY INJURY OF ANY PERSON OR IN PHYSICAL OR ENVIRONMENTAL DAMAGE (COLLECTIVELY, "HIGH-RISK USE"), AND THAT YOU WILL ENSURE THAT, IN THE EVENT OF ANY INTERRUPTION, DEFECT, ERROR, OR OTHER FAILURE OF THE SOFTWARE, THE SAFETY OF PEOPLE, PROPERTY, AND THE ENVIRONMENT ARE NOT REDUCED BELOW A LEVEL THAT IS REASONABLY, APPROPRIATE, AND LEGAL, WHETHER IN GENERAL OR IN A SPECIFIC INDUSTRY. BY ACCESSING THE SOFTWARE, YOU FURTHER ACKNOWLEDGE THAT YOUR HIGH-RISK USE OF THE SOFTWARE IS AT YOUR OWN RISK.

docs/CustomizingAzdParameters.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ To customize any of the above values, run the following command **before** `azd
2727
azd env set <PARAMETER_NAME> <VALUE>
2828
```
2929

30+
Set the Log Analytics Workspace Id if you need to reuse the existing workspace which is already existing
31+
```shell
32+
azd env set AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID '/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.OperationalInsights/workspaces/<workspace-name>'
33+
```
34+
3035
**Example:**
3136

3237
```bash

docs/DeploymentGuide.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ Check the [Azure Products by Region](https://azure.microsoft.com/en-us/explore/g
1010
- Azure OpenAI Service
1111
- GPT Model Capacity
1212

13-
Here are some example regions where the services are available: East US, East US2, Japan East, UK South, Sweden Central.
13+
> ⚠️ **Region-Specific Deployment Constraints:**
14+
> This application is currently supported only in the following Azure regions. Please ensure you select one of these regions during deployment to avoid failures:
15+
>
16+
> - Australia East
17+
> - East US
18+
> - East US 2
19+
> - France Central
20+
> - Japan East
21+
> - Norway East
22+
> - South India
23+
> - Sweden Central
24+
> - UK South
25+
> - West US
26+
> - West US 3
1427
1528
### ⚠️ Important: Check Azure OpenAI Quota Availability
1629

@@ -29,6 +42,7 @@ When you start the deployment, most parameters will have **default values**, but
2942
| **Resource Prefix** | Prefix for all resources created by this template. This prefix will be used to create unique names for all resources. The prefix must be unique within the resource group. | None |
3043
| **AI Location** | Location for all AI services resources. This location can be different from the resource group location | None |
3144
| **Capacity** | Configure capacity for **gpt-4o**. | 5k |
45+
| **Existing Log analytics workspace** | To reuse the existing Log analytics workspace Id. | |
3246

3347
This accelerator can be configured to use authentication.
3448

infra/deploy_ai_foundry.bicep

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ param managedIdentityObjectId string
1111
param aiServicesEndpoint string
1212
param aiServicesKey string
1313
param aiServicesId string
14+
15+
param existingLogAnalyticsWorkspaceId string = ''
16+
17+
var useExisting = !empty(existingLogAnalyticsWorkspaceId)
18+
var existingLawSubscription = useExisting ? split(existingLogAnalyticsWorkspaceId, '/')[2] : ''
19+
var existingLawResourceGroup = useExisting ? split(existingLogAnalyticsWorkspaceId, '/')[4] : ''
20+
var existingLawName = useExisting ? split(existingLogAnalyticsWorkspaceId, '/')[8] : ''
21+
1422
var abbrs = loadJsonContent('./abbreviations.json')
1523

1624
var storageName = '${abbrs.storage.storageAccount}${solutionName}'
@@ -34,7 +42,12 @@ resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
3442
name: keyVaultName
3543
}
3644

37-
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
45+
resource existingLogAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' existing = if (useExisting) {
46+
name: existingLawName
47+
scope: resourceGroup(existingLawSubscription, existingLawResourceGroup)
48+
}
49+
50+
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = if (!useExisting) {
3851
name: workspaceName
3952
location: location
4053
tags: {}
@@ -316,7 +329,7 @@ output aiProjectName string = aiHubProject.name
316329

317330
output storageAccountName string = storageNameCleaned
318331

319-
output logAnalyticsId string = logAnalytics.id
332+
output logAnalyticsId string = useExisting ? existingLogAnalyticsWorkspace.id : logAnalytics.id
320333
output storageAccountId string = storage.id
321334
output applicationInsightsConnectionString string = applicationInsights.properties.ConnectionString
322335

infra/main.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ param AzureAiServiceLocation string // The location used for all deployed resou
2727
@description('Capacity of the GPT deployment:')
2828
param capacity int = 5
2929

30+
param existingLogAnalyticsWorkspaceId string = ''
31+
3032
@minLength(1)
3133
@description('GPT model deployment type:')
3234
param deploymentType string = 'GlobalStandard'
@@ -142,6 +144,7 @@ module azureAifoundry 'deploy_ai_foundry.bicep' = {
142144
aiServicesEndpoint: azureAiServices.properties.endpoint
143145
aiServicesKey: azureAiServices.listKeys().key1
144146
aiServicesId: azureAiServices.id
147+
existingLogAnalyticsWorkspaceId: existingLogAnalyticsWorkspaceId
145148
}
146149
scope: resourceGroup(resourceGroup().name)
147150
}

infra/main.bicepparam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ param deploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE'
88
param llmModel = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')
99
param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06')
1010
param imageVersion = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest')
11+
param existingLogAnalyticsWorkspaceId = readEnvironmentVariable('AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID', '')

0 commit comments

Comments
 (0)