Skip to content

Commit 96c5987

Browse files
Merge pull request #387 from microsoft/main
fix: down merging main to dev
2 parents 5d81505 + 7fb6991 commit 96c5987

28 files changed

+382
-116
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Each line is a file pattern followed by one or more owners.
33

44
# These owners will be the default owners for everything in the repo.
5-
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @dongbumlee
5+
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @dongbumlee @Vinay-Microsoft @aniaroramsft

.github/dependabot.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,36 @@
22
# package ecosystems to update and where the package manifests are located.
33
# For more details, refer to the documentation:
44
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
56
version: 2
67
updates:
7-
# GitHub Actions dependencies
8+
# GitHub Actions dependencies (grouped)
89
- package-ecosystem: "github-actions"
910
directory: "/"
1011
schedule:
1112
interval: "monthly"
1213
commit-message:
1314
prefix: "build"
1415
target-branch: "dependabotchanges"
15-
open-pull-requests-limit: 100
16+
open-pull-requests-limit: 10
17+
groups:
18+
all-actions:
19+
patterns:
20+
- "*"
1621

17-
# .NET NuGet dependencies for Backend API (Multiple Projects)
22+
# .NET NuGet dependencies (grouped)
1823
- package-ecosystem: "nuget"
1924
directory: "/App/backend-api/Microsoft.GS.DPS"
2025
schedule:
2126
interval: "monthly"
2227
commit-message:
2328
prefix: "build"
2429
target-branch: "dependabotchanges"
25-
open-pull-requests-limit: 100
30+
open-pull-requests-limit: 10
31+
groups:
32+
nuget-deps:
33+
patterns:
34+
- "*"
2635

2736
- package-ecosystem: "nuget"
2837
directory: "/App/backend-api/Microsoft.GS.DPS.Host"
@@ -31,17 +40,24 @@ updates:
3140
commit-message:
3241
prefix: "build"
3342
target-branch: "dependabotchanges"
34-
open-pull-requests-limit: 100
43+
open-pull-requests-limit: 10
44+
groups:
45+
nuget-deps:
46+
patterns:
47+
- "*"
3548

36-
# .NET NuGet dependencies for Kernel Memory Clients
3749
- package-ecosystem: "nuget"
3850
directory: "/App/kernel-memory/clients/dotnet/SemanticKernelPlugin"
3951
schedule:
4052
interval: "monthly"
4153
commit-message:
4254
prefix: "build"
4355
target-branch: "dependabotchanges"
44-
open-pull-requests-limit: 100
56+
open-pull-requests-limit: 10
57+
groups:
58+
nuget-deps:
59+
patterns:
60+
- "*"
4561

4662
- package-ecosystem: "nuget"
4763
directory: "/App/kernel-memory/clients/dotnet/WebClient"
@@ -50,14 +66,22 @@ updates:
5066
commit-message:
5167
prefix: "build"
5268
target-branch: "dependabotchanges"
53-
open-pull-requests-limit: 100
69+
open-pull-requests-limit: 10
70+
groups:
71+
nuget-deps:
72+
patterns:
73+
- "*"
5474

55-
# npm dependencies for Frontend App
75+
# npm dependencies for Frontend App (grouped)
5676
- package-ecosystem: "npm"
5777
directory: "/App/frontend-app"
5878
schedule:
5979
interval: "monthly"
6080
commit-message:
6181
prefix: "build"
6282
target-branch: "dependabotchanges"
63-
open-pull-requests-limit: 100
83+
open-pull-requests-limit: 10
84+
groups:
85+
frontend-deps:
86+
patterns:
87+
- "*"
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."

App/kernel-memory/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ItemGroup>
66
<PackageVersion Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
77
<PackageVersion Include="AWSSDK.S3" Version="3.7.310.4" />
8-
<PackageVersion Include="Azure.AI.DocumentIntelligence" Version="1.0.0-beta.2" />
8+
<PackageVersion Include="Azure.AI.DocumentIntelligence" Version="1.0.0" />
99
<PackageVersion Include="Azure.AI.FormRecognizer" Version="4.1.0" />
1010
<PackageVersion Include="Azure.Core" Version="1.42.0" />
1111
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.1" />

App/kernel-memory/service/Core/DataFormats/Pdf/PdfMarkdownDecoder.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public async Task<FileContent> DecodeAsync(string filename, CancellationToken ca
3838

3939
public async Task<FileContent> DecodeAsync(BinaryData data, CancellationToken cancellationToken = default)
4040
{
41-
var content = new AnalyzeDocumentContent() { Base64Source = data };
41+
var analyzeDocumentOptions = new AnalyzeDocumentOptions("prebuilt-layout", data)
42+
{
43+
OutputContentFormat = DocumentContentFormat.Markdown
44+
};
4245

4346
//this invocation should be blocking during process
4447
DocumentIntelligenceClientOptions options = new()
@@ -49,7 +52,7 @@ public async Task<FileContent> DecodeAsync(BinaryData data, CancellationToken ca
4952
this._client = new DocumentIntelligenceClient(new Uri(this._endpoint), new AzureKeyCredential(this._apiKey), options);
5053

5154
Operation<AnalyzeResult> operation = null;
52-
operation = await this._client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-layout", content, outputContentFormat: ContentFormat.Markdown, cancellationToken: cancellationToken).ConfigureAwait(false);
55+
operation = await this._client.AnalyzeDocumentAsync(WaitUntil.Completed, analyzeDocumentOptions, cancellationToken).ConfigureAwait(false);
5356

5457
AnalyzeResult result = operation.Value;
5558

Deployment/kubernetes/enable_approuting.psm1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ function Enable-AppRouting {
1414
# Enable application routing
1515
az aks approuting enable --resource-group $ResourceGroupName --name $ClusterName
1616

17-
# Enable HTTP application routing addon
18-
az aks enable-addons --resource-group $ResourceGroupName --name $ClusterName --addons http_application_routing
1917
}
2018

2119
Export-ModuleMember -Function Enable-AppRouting

Deployment/resourcedeployment.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,20 @@ class DeploymentResult {
398398

399399
function Check-Docker {
400400
try {
401-
# Try to get Docker info to check if Docker daemon is running
402-
$dockerInfo = docker info 2>&1
403-
if ($dockerInfo -match "ERROR: error during connect") {
401+
# Try to get Docker info to check if Docker daemon is running
402+
$dockerInfo = docker info 2>&1
403+
if ($LASTEXITCODE -ne 0 -or $dockerInfo -match "error during connect") {
404404
return $false
405-
} else {
405+
}
406+
else {
406407
return $true
407408
}
408-
} catch {
409+
}
410+
catch {
409411
Write-Host "An error occurred while checking Docker status." -ForegroundColor Red
410412
Write-Host $_.Exception.Message -ForegroundColor Red
411-
return $false }
413+
return $false
414+
}
412415
}
413416

414417
# Check if Docker is running before proceeding

Images/readme/customerTruth.png

-182 KB
Binary file not shown.

Images/readme/quickDeploy.png

-89.8 KB
Binary file not shown.
-186 KB
Binary file not shown.

0 commit comments

Comments
 (0)