Skip to content

Commit bc71d23

Browse files
Merge pull request #576 from microsoft/main
feat: Use agents for kernel function & Enhance devcontainer, CI/CD workflows, and Dependabot automation
2 parents 785cbb3 + c771cef commit bc71d23

File tree

270 files changed

+26386
-8701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+26386
-8701
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
44
"forwardPorts": [50505],
55
"features": {
6-
"ghcr.io/azure/azure-dev/azd:latest": {}
6+
"ghcr.io/azure/azure-dev/azd:latest": {},
7+
"ghcr.io/devcontainers/features/azure-cli:1": {},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
79
},
810
"customizations": {
911
"vscode": {
@@ -16,7 +18,7 @@
1618
]
1719
}
1820
},
19-
"postStartCommand": "git pull origin main && python3 -m pip install -r infra/scripts/index_scripts/requirements.txt && curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash && chmod +x ./infra/scripts/quota_check_params.sh",
21+
"postStartCommand": "bash ./.devcontainer/setup_env.sh",
2022
"remoteUser": "vscode",
2123
"hostRequirements": {
2224
"memory": "4gb"

.devcontainer/setup_env.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
git fetch
4+
git pull
5+
6+
# provide execute permission to quotacheck script
7+
sudo chmod +x ./infra/scripts/checkquota_km.sh
8+
sudo chmod +x ./infra/scripts/quota_check_params.sh
9+
sudo chmod +x ./infra/scripts/run_process_data_scripts.sh

.github/dependabot.yml

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,52 @@
11
version: 2
2+
23
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
4+
# GitHub Actions - grouped
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "monthly"
9+
target-branch: "dependabotchanges"
10+
commit-message:
11+
prefix: "build"
12+
open-pull-requests-limit: 10
13+
groups:
14+
github-actions:
15+
patterns:
16+
- "*"
1217

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

22-
- package-ecosystem: "npm"
23-
directory: "/src/App"
24-
schedule:
25-
interval: "monthly"
26-
commit-message:
27-
prefix: "build"
28-
target-branch: "dependabotchanges"
29-
open-pull-requests-limit: 100
30-
registries:
31-
- npm_public_registry # Only use public npm registry
32+
# Frontend npm dependencies - grouped
33+
- package-ecosystem: "npm"
34+
directory: "/src/App"
35+
schedule:
36+
interval: "monthly"
37+
target-branch: "dependabotchanges"
38+
commit-message:
39+
prefix: "build"
40+
open-pull-requests-limit: 10
41+
registries:
42+
- npm_public_registry
43+
groups:
44+
frontend-deps:
45+
patterns:
46+
- "*"
3247

3348
registries:
34-
npm_public_registry:
35-
type: "npm-registry"
36-
url: "https://registry.npmjs.org/"
37-
token: ${{ secrets.TOKEN }}
49+
npm_public_registry:
50+
type: "npm-registry"
51+
url: "https://registry.npmjs.org/"
52+
token: ${{ secrets.TOKEN }}
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."

.github/workflows/azure-dev-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
# Step 2: Validate the Azure template using microsoft/template-validation-action
2121
- name: Validate Azure Template
22-
uses: microsoft/template-validation-action@v0.3.5
22+
uses: microsoft/template-validation-action@v0.4.3
2323
id: validation
2424
env:
2525
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}

.github/workflows/bicep_deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout Code
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: Run Quota Check
1616
id: quota-check
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Broken Link Checker
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.md'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
markdown-link-check:
14+
name: Check Markdown Broken Links
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Repo
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
# For PR : Get only changed markdown files
24+
- name: Get changed markdown files (PR only)
25+
id: changed-markdown-files
26+
if: github.event_name == 'pull_request'
27+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
28+
with:
29+
files: |
30+
**/*.md
31+
32+
33+
# For PR: Check broken links only in changed files
34+
- name: Check Broken Links in Changed Markdown Files
35+
id: lychee-check-pr
36+
if: github.event_name == 'pull_request' && steps.changed-markdown-files.outputs.any_changed == 'true'
37+
uses: lycheeverse/[email protected]
38+
with:
39+
args: >
40+
--verbose --exclude-mail --no-progress --exclude ^https?://
41+
${{ steps.changed-markdown-files.outputs.all_changed_files }}
42+
failIfEmpty: false
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
# For manual trigger: Check all markdown files in repo
47+
- name: Check Broken Links in All Markdown Files in Entire Repo (Manual Trigger)
48+
id: lychee-check-manual
49+
if: github.event_name == 'workflow_dispatch'
50+
uses: lycheeverse/[email protected]
51+
with:
52+
args: >
53+
--verbose --exclude-mail --no-progress --exclude ^https?://
54+
'**/*.md'
55+
failIfEmpty: false
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ jobs:
4747

4848
steps:
4949
- name: Checkout repository
50-
uses: actions/checkout@v3
50+
uses: actions/checkout@v4
5151

5252
# Installing DotNet version
53-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v4
5454
- name: Setup dotnet ${{ matrix.dotnet-version }}
55-
uses: actions/setup-dotnet@v3
55+
uses: actions/setup-dotnet@v4
5656
with:
5757
dotnet-version: ${{ matrix.dotnet-version }}
5858
# You can test your matrix by printing the current dotnet version
@@ -61,7 +61,7 @@ jobs:
6161

6262
# Initializes the CodeQL tools for scanning.
6363
- name: Initialize CodeQL
64-
uses: github/codeql-action/init@v2
64+
uses: github/codeql-action/init@v3
6565
with:
6666
languages: ${{ matrix.language }}
6767
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -88,6 +88,6 @@ jobs:
8888
# ./location_of_script_within_repo/buildscript.sh
8989

9090
- name: Perform CodeQL Analysis
91-
uses: github/codeql-action/analyze@v2
91+
uses: github/codeql-action/analyze@v3
9292
with:
9393
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)