Skip to content

Commit d729dae

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents b734bce + 1d056a6 commit d729dae

File tree

87 files changed

+4298
-502
lines changed

Some content is hidden

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

87 files changed

+4298
-502
lines changed

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Multi Agent Custom Automation Engine Solution Accelerator",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.10",
4+
"features": {
5+
"ghcr.io/devcontainers/features/azure-cli:1.0.8": {},
6+
"ghcr.io/azure/azure-dev/azd:latest": {},
7+
"ghcr.io/rchaganti/vsc-devcontainer-features/azurebicep:1.0.5": {}
8+
},
9+
10+
"postCreateCommand": "sudo chmod +x .devcontainer/setupEnv.sh && ./.devcontainer/setupEnv.sh",
11+
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-azuretools.azure-dev",
16+
"ms-azuretools.vscode-bicep",
17+
"ms-python.python"
18+
]
19+
},
20+
"codespaces": {
21+
"openFiles": [
22+
"README.md"
23+
]
24+
}
25+
},
26+
27+
"remoteUser": "vscode",
28+
"hostRequirements": {
29+
"memory": "8gb"
30+
}
31+
}

.devcontainer/setupEnv.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
pip install --upgrade pip
4+
5+
6+
(cd ./src/frontend; pip install -r requirements.txt)
7+
8+
9+
(cd ./src/backend; pip install -r requirements.txt)
10+
11+

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
max-line-length = 88
33
extend-ignore = E501
44
exclude = .venv, frontend
5-
ignore = E203, W503, G004, G200
5+
ignore = E203, W503, G004, G200, E402

.github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77
contents: write
88
pull-requests: write
99

10-
name: create-release
10+
name: Create-Release
1111

1212
jobs:
1313
create-release:

.github/workflows/deploy.yml

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: CI-Validate Deployment-Multi-Agent-Custom-Automation-Engine-Solution-Accelerator
1+
name: Validate Deployment
22

33
on:
44
push:
55
branches:
66
- main
77
schedule:
8-
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
8+
- cron: '0 11,23 * * *' # Runs at 11:00 AM and 11:00 PM GMT
99

1010
jobs:
1111
deploy:
@@ -14,6 +14,49 @@ jobs:
1414
- name: Checkout Code
1515
uses: actions/checkout@v3
1616

17+
- name: Run Quota Check
18+
id: quota-check
19+
run: |
20+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
21+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
22+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
23+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
24+
export GPT_MIN_CAPACITY="50"
25+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
26+
27+
chmod +x deploy/scripts/checkquota.sh
28+
if ! deploy/scripts/checkquota.sh; then
29+
# If quota check fails due to insufficient quota, set the flag
30+
if grep -q "No region with sufficient quota found" deploy/scripts/checkquota.sh; then
31+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
32+
fi
33+
exit 1 # Fail the pipeline if any other failure occurs
34+
fi
35+
36+
- name: Send Notification on Quota Failure
37+
if: env.QUOTA_FAILED == 'true'
38+
run: |
39+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
40+
EMAIL_BODY=$(cat <<EOF
41+
{
42+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the pipeline cannot proceed.</p><p><strong>Build URL:</strong> ${RUN_URL}</p><p>Please take necessary action.</p><p>Best regards,<br>Your Automation Team</p>"
43+
}
44+
EOF
45+
)
46+
47+
curl -X POST "${{ secrets.AUTO_LOGIC_APP_URL }}" \
48+
-H "Content-Type: application/json" \
49+
-d "$EMAIL_BODY" || echo "Failed to send notification"
50+
51+
- name: Fail Pipeline if Quota Check Fails
52+
if: env.QUOTA_FAILED == 'true'
53+
run: exit 1
54+
55+
- name: Set Deployment Region
56+
run: |
57+
echo "Selected Region: $VALID_REGION"
58+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
59+
1760
- name: Setup Azure CLI
1861
run: |
1962
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
@@ -45,7 +88,7 @@ jobs:
4588
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
4689
if [ "$rg_exists" = "false" ]; then
4790
echo "Resource group does not exist. Creating..."
48-
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location eastus || { echo "Error creating resource group"; exit 1; }
91+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location ${{ env.AZURE_LOCATION }} || { echo "Error creating resource group"; exit 1; }
4992
else
5093
echo "Resource group already exists."
5194
fi
@@ -58,7 +101,7 @@ jobs:
58101
az deployment group create \
59102
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
60103
--template-file deploy/macae.bicep \
61-
--parameters azureOpenAILocation=eastus cosmosLocation=eastus2
104+
--parameters azureOpenAILocation=${{env.AZURE_LOCATION }} cosmosLocation=${{env.AZURE_LOCATION }}
62105
63106
64107
- name: Send Notification on Failure

.github/workflows/docker-build-and-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Push Docker Image
1+
name: Build Docker and Optional Push
22

33
on:
44
push:
@@ -32,7 +32,7 @@ jobs:
3232
uses: docker/setup-buildx-action@v1
3333

3434
- name: Log in to Azure Container Registry
35-
if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix') }}
35+
if: ${{ (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix') }}
3636
uses: azure/docker-login@v2
3737
with:
3838
login-server: ${{ secrets.ACR_LOGIN_SERVER }}

.github/workflows/pr-title-checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "pr-title-checker"
1+
name: "PR Title Checker"
22

33
on:
44
pull_request_target:

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pylint and Flake8
1+
name: PyLint
22

33
on: [push]
44

.github/workflows/stale-bot.yml

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,82 @@
1-
name: 'Close stale issues and PRs'
1+
name: "Manage Stale Issues, PRs & Unmerged Branches"
22
on:
33
schedule:
4-
- cron: '0 1 * * *'
5-
4+
- cron: '30 1 * * *' # Runs daily at 1:30 AM UTC
5+
workflow_dispatch: # Allows manual triggering
66
permissions:
77
contents: write
88
issues: write
99
pull-requests: write
10-
1110
jobs:
1211
stale:
1312
runs-on: ubuntu-latest
1413
steps:
15-
- uses: actions/stale@v9
14+
- name: Mark Stale Issues and PRs
15+
uses: actions/stale@v9
1616
with:
17-
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.'
17+
stale-issue-message: "This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or it will be closed in 30 days."
18+
stale-pr-message: "This PR is stale because it has been open 180 days with no activity. Please update or it will be closed in 30 days."
1819
days-before-stale: 180
19-
days-before-close: 30
20+
days-before-close: 30
21+
exempt-issue-labels: "keep"
22+
exempt-pr-labels: "keep"
23+
cleanup-branches:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0 # Fetch full history for accurate branch checks
30+
- name: Fetch All Branches
31+
run: git fetch --all --prune
32+
- name: List Merged Branches With No Activity in Last 3 Months
33+
run: |
34+
35+
echo "Branch Name,Last Commit Date,Committer,Committed In Branch,Action" > merged_branches_report.csv
36+
37+
for branch in $(git for-each-ref --format '%(refname:short) %(committerdate:unix)' refs/remotes/origin | awk -v date=$(date -d '3 months ago' +%s) '$2 < date {print $1}'); do
38+
if [[ "$branch" != "origin/main" && "$branch" != "origin/dev" ]]; then
39+
branch_name=${branch#origin/}
40+
# Ensure the branch exists locally before getting last commit date
41+
git fetch origin "$branch_name" || echo "Could not fetch branch: $branch_name"
42+
last_commit_date=$(git log -1 --format=%ci "origin/$branch_name" || echo "Unknown")
43+
committer_name=$(git log -1 --format=%cn "origin/$branch_name" || echo "Unknown")
44+
committed_in_branch=$(git branch -r --contains "origin/$branch_name" | tr -d ' ' | paste -sd "," -)
45+
echo "$branch_name,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
46+
fi
47+
done
48+
- name: List PR Approved and Merged Branches Older Than 30 Days
49+
run: |
50+
51+
for branch in $(gh api repos/${{ github.repository }}/pulls --jq '.[] | select(.merged_at != null and (.base.ref == "main" or .base.ref == "dev")) | select(.merged_at | fromdateiso8601 < (now - 2592000)) | .head.ref'); do
52+
# Ensure the branch exists locally before getting last commit date
53+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
54+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
55+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
56+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
57+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
58+
done
59+
env:
60+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
- name: List Open PR Branches With No Activity in Last 3 Months
62+
run: |
63+
64+
for branch in $(gh api repos/${{ github.repository }}/pulls --state open --jq '.[] | select(.base.ref == "main" or .base.ref == "dev") | .head.ref'); do
65+
# Ensure the branch exists locally before getting last commit date
66+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
67+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
68+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
69+
if [[ $(date -d "$last_commit_date" +%s) -lt $(date -d '3 months ago' +%s) ]]; then
70+
# If no commit in the last 3 months, mark for deletion
71+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
72+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
73+
fi
74+
done
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
- name: Upload CSV Report of Inactive Branches
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: merged-branches-report
81+
path: merged_branches_report.csv
82+
retention-days: 30

.github/workflows/test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
run: |
3838
python -m pip install --upgrade pip
3939
pip install -r src/backend/requirements.txt
40-
pip install pytest-cov
41-
pip install pytest-asyncio
4240
4341
- name: Check if test files exist
4442
id: check_tests
@@ -50,7 +48,6 @@ jobs:
5048
echo "Test files found, running tests."
5149
echo "skip_tests=false" >> $GITHUB_ENV
5250
fi
53-
5451
- name: Run tests with coverage
5552
if: env.skip_tests == 'false'
5653
run: |
@@ -59,4 +56,4 @@ jobs:
5956
- name: Skip coverage report if no tests
6057
if: env.skip_tests == 'true'
6158
run: |
62-
echo "Skipping coverage report because no tests were found."
59+
echo "Skipping coverage report because no tests were found."

0 commit comments

Comments
 (0)