Skip to content

Commit 6fcb813

Browse files
Merge branch 'psl-standardize-bicep-params' of https://github.com/microsoft/Build-your-own-copilot-Solution-Accelerator into psl-standardize-bicep-params
2 parents db1738e + f69d8e1 commit 6fcb813

24 files changed

+239
-26
lines changed

.github/dependabot.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: 2
2+
23
updates:
34
# 1. React (JavaScript/TypeScript) dependencies
45
- package-ecosystem: "npm"
@@ -8,32 +9,50 @@ updates:
89
commit-message:
910
prefix: "build"
1011
target-branch: "dependabotchanges"
11-
open-pull-requests-limit: 100
12+
open-pull-requests-limit: 10
13+
groups:
14+
frontend-deps:
15+
patterns:
16+
- "*"
1217

13-
# 2. Python dependencies
18+
# 2. Python dependencies – App
1419
- package-ecosystem: "pip"
1520
directory: "/src/App"
1621
schedule:
1722
interval: "monthly"
1823
commit-message:
1924
prefix: "build"
2025
target-branch: "dependabotchanges"
21-
open-pull-requests-limit: 100
22-
26+
open-pull-requests-limit: 10
27+
groups:
28+
backend-deps:
29+
patterns:
30+
- "*"
31+
32+
# 3. Python dependencies – Fabric Scripts
2333
- package-ecosystem: "pip"
2434
directory: "/src/infra/scripts/fabric_scripts"
2535
schedule:
2636
interval: "monthly"
2737
commit-message:
2838
prefix: "build"
2939
target-branch: "dependabotchanges"
30-
open-pull-requests-limit: 100
40+
open-pull-requests-limit: 10
41+
groups:
42+
backend-deps:
43+
patterns:
44+
- "*"
3145

46+
# 4. Python dependencies – Index Scripts
3247
- package-ecosystem: "pip"
3348
directory: "/src/infra/scripts/index_scripts"
3449
schedule:
3550
interval: "monthly"
3651
commit-message:
3752
prefix: "build"
3853
target-branch: "dependabotchanges"
39-
open-pull-requests-limit: 100
54+
open-pull-requests-limit: 10
55+
groups:
56+
backend-deps:
57+
patterns:
58+
- "*"
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This solution accelerator is a powerful tool that helps you create your own copi
66

77
<div align="center">
88

9-
[**SOLUTION OVERVIEW**](#solution-overview) \| [**QUICK DEPLOY**](#quick-deploy) \| [**BUSINESS USE CASE**](#business-use-case) \| [**SUPPORTING DOCUMENTATION**](#supporting-documentation)
9+
[**SOLUTION OVERVIEW**](#solution-overview) \| [**QUICK DEPLOY**](#quick-deploy) \| [**BUSINESS SCENARIO**](#business-scenario) \| [**SUPPORTING DOCUMENTATION**](#supporting-documentation)
1010

1111
</div>
1212
<br/>
@@ -49,7 +49,7 @@ Leverages Azure OpenAI Service and Azure AI Search, this solution streamlines da
4949
Azure OpenAI Service helps to summarize the conversations and actions for the next meeting.​
5050

5151
- **Chat with data** <br/>
52-
Azure OpenAI Service helpsenable chat with structured and unstructured data using Semantic Kernel autonomous function calling.​
52+
Azure OpenAI Service helps enable chat with structured and unstructured data using Semantic Kernel autonomous function calling.​
5353

5454
</details>
5555

@@ -117,7 +117,7 @@ either by deleting the resource group in the Portal or running `azd down`.
117117

118118
<br /><br />
119119
<h2><img src="./docs/images/readme/business-scenario.png" width="48" />
120-
Business Use Case
120+
Business Scenario
121121
</h2>
122122

123123

docs/AppAuthentication.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Set up Authentication in Azure Container App
1+
# Set Up Authentication in Azure App Service
22

33
This document provides step-by-step instructions to configure Azure App Registrations for a front-end application.
44

@@ -7,22 +7,27 @@ This document provides step-by-step instructions to configure Azure App Registra
77
- Access to **Microsoft Entra ID**
88
- Necessary permissions to create and manage **App Registrations**
99

10-
## Add Authentication in Azure App Service configuration
10+
## Step 1: Add Authentication in Azure App Service configuration
1111

1212
1. Click on `Authentication` from left menu.
1313

1414
![Authentication](images/AppAuthentication.png)
1515

16-
1. Click on `+ Add identity provider` to see a list of identity providers.
16+
2. Click on `+ Add identity provider` to see a list of identity providers.
1717

1818
![Authentication Identity](images/AppAuthenticationIdentityNew.png)
1919

20-
1. Click on `+ Add Provider` to see a list of identity providers.
20+
3. Click on `Identity Provider` dropdown to see a list of identity providers.
2121

2222
![Add Provider](images/AppAuthIdentityProvider.png)
2323

24-
1. Select the first option `Microsoft Entra Id` from the drop-down list.
24+
4. Select the first option `Microsoft Entra Id` from the drop-down list and select `client secret expiration` under App registration.
25+
> NOTE: If `Create new app registration` is disabled, then go to [Create new app registration](/docs/create_new_app_registration.md) and come back to this step to complete the app authentication.
26+
2527
![Add Provider](images/AppAuthIdentityProviderAdd.png)
2628

27-
1. Accept the default values and click on `Add` button to go back to the previous page with the identify provider added.
28-
![Authentication Identity](images/AppAuthenticationIdentity.png)
29+
5. Accept the default values and click on `Add` button to go back to the previous page with the identify provider added.
30+
31+
![Authentication Identity](images/AppAuthenticationIdentity.png)
32+
33+
6. You have successfully added app authentication, and now required to log in to access the application.

docs/AzureSemanticSearchRegion.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Steps to Check Semantic Search Availability
44
1. Open the [Semantic Search Availability](https://learn.microsoft.com/en-us/azure/search/search-region-support) page.
5-
2. Scroll down to the **"Availability by Region"** section.
6-
3. Use the table to find supported regions for **Azure AI Search** and its **Semantic Search** feature.
7-
4. If your target region is not listed, choose a supported region for deployment.
5+
2. Scroll down to the **"Azure public region"** section.
6+
3. Use the table to find supported regions for **Azure AI Search** and its **Semantic ranker** feature.
7+
4. If your target region is not listed, choose a supported region for deployment.

docs/CustomizingAzdParameters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ To customize any of the above values, run the following command **before** `azd
2727

2828
```bash
2929
azd env set <PARAMETER_NAME> <VALUE>
30+
3031
```
3132

3233
**Example:**

docs/DeploymentGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ This will rebuild the source code, package it into a container, and push it to t
215215
```
216216

217217
2. **Add Authentication Provider**
218-
- Follow steps in [App Authentication](./AppAuthentication.md) to configure authenitcation in app service. Note that Authentication changes can take up to 10 minutes.
218+
- Follow steps in [App Authentication](./AppAuthentication.md) to configure authentication in app service. Note that Authentication changes can take up to 10 minutes.
219219

220220
3. **Deleting Resources After a Failed Deployment**
221221

docs/ManualAppRegistrationConfiguration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ This guide provides detailed steps to manually register both front-end and backe
2323
- Copy the Default domain url from the Overview .
2424

2525
- Click **Register**
26-
![ManualRegisterAppWeb1](./Images/ManualRegisterAppWeb1.png)
26+
![ManualRegisterAppWeb1](./images/ManualRegisterAppWeb1.png)
2727

2828

2929

@@ -36,13 +36,13 @@ This guide provides detailed steps to manually register both front-end and backe
3636
- Start (Optional for custom range): Set the starting date of the secret's validity
3737
- End (Optional for custom range): Set the ending date of the secret's validity
3838
- Click **Add** and remember to copy and store the secret value securely as it will not be shown again
39-
![ManualRegisterAppWeb3](./Images/ManualRegisterAppWeb3.png)
39+
![ManualRegisterAppWeb3](./images/ManualRegisterAppWeb3.png)
4040

4141
### 3. Get Tenant ID
4242
- Go to **Tenant Properties** in [Azure Portal](https://portal.azure.com)
4343
- Copy the Tenant ID (will be used in next step)
4444

45-
![ManualRegisterAppWeb6](./Images/ManualRegisterAppWeb6.png)
45+
![ManualRegisterAppWeb6](./images/ManualRegisterAppWeb6.png)
4646

4747
### 4. Set Up Authentication in Web Container App
4848

@@ -57,10 +57,10 @@ This guide provides detailed steps to manually register both front-end and backe
5757
- **Allowed Token Audiences**: Usually the Application ID URI or Client ID
5858
- Click **Add**
5959

60-
![ManualRegisterAppWeb4](./Images/ManualRegisterAppWeb4.png)
60+
![ManualRegisterAppWeb4](./images/ManualRegisterAppWeb4.png)
6161

6262
---
6363

6464
## Conclusion
6565

66-
You have now manually configured Azure App Registrations.
66+
You have now manually configured Azure App Registrations.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Creating a new App Registration
2+
3+
1. Click on `Home` and select `Microsoft Entra ID`.
4+
5+
![Microsoft Entra ID](images/MicrosoftEntraID.png)
6+
7+
2. Click on `App registrations`.
8+
9+
![App registrations](images/Appregistrations.png)
10+
11+
3. Click on `+ New registration`.
12+
13+
![New Registrations](images/NewRegistration.png)
14+
15+
4. Provide the `Name`, select supported account types as `Accounts in this organizational directory only(Contoso only - Single tenant)`, select platform as `Web`, enter/select the `URL` and register.
16+
17+
![Add Details](images/AddDetails.png)
18+
19+
5. After application is created successfully, then click on `Add a Redirect URL`.
20+
21+
![Redirect URL](images/AddRedirectURL.png)
22+
23+
6. Click on `+ Add a platform`.
24+
25+
![+ Add platform](images/AddPlatform.png)
26+
27+
7. Click on `Web`.
28+
29+
![Web](images/Web.png)
30+
31+
8. Enter the `web app URL` (Provide the app service name in place of XXXX) and Save. Then go back to [Set Up Authentication in Azure App Service](/docs/AppAuthentication) Step 1 page and follow from _Point 4_ choose `Pick an existing app registration in this directory` from the Add an Identity Provider page and provide the newly registered App Name.
32+
33+
E.g. <<https://<< appservicename >>.azurewebsites.net/.auth/login/aad/callback>>
34+
35+
![Add Details](images/WebAppURL.png)

docs/images/AddDetails.png

350 KB
Loading

0 commit comments

Comments
 (0)