Skip to content

Commit 1db59a2

Browse files
authored
Merge pull request #966 from TechnologyEnhancedLearning/Automatic_version_update_dependabot
Automatic version update dependabot to RC
2 parents fc01ec7 + 6412361 commit 1db59a2

File tree

28 files changed

+35681
-22504
lines changed

28 files changed

+35681
-22504
lines changed

.github/dependabot.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "nuget"
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
open-pull-requests-limit: 10
13+
target-branch: "Automatic_version_update_dependabot"
14+
ignore:
15+
# Ignore updates to packages that start with 'Wildcards'
16+
- dependency-name: "Microsoft.FeatureManagement.AspNetCore*"
17+
- dependency-name: "LearningHub.Nhs.Models*"
18+
- dependency-name: "LearningHub.Nhs.Caching*"
19+
- dependency-name: "elfhHub.Nhs.Models*"
20+
- dependency-name: "linqtotwitter*"
21+
# Ignore some updates to the package
22+
- dependency-name: "Microsoft.VisualStudio.Web.CodeGeneration.Design"
23+
versions: [">7.0.0"]
24+
- dependency-name: "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
25+
versions: [">7.0.0"]
26+
- dependency-name: "Microsoft.AspNetCore.Mvc.Testing"
27+
versions: [">7.0.0"]
28+
- dependency-name: "Selenium.WebDriver.ChromeDriver"
29+
versions: ">=113.0.5672.1278" # Recommended version
30+
# For all packages, ignore all patch updates
31+
#- dependency-name: "*"
32+
# update-types: ["version-update:semver-patch"]
33+
34+
# Configuration for npm WebUI
35+
- package-ecosystem: "npm"
36+
directory: "LearningHub.Nhs.WebUI/" # Location of package manifests
37+
schedule:
38+
interval: "daily"
39+
target-branch: "Automatic_version_update_dependabot"
40+
# - "dependencies"
41+
open-pull-requests-limit: 10
42+
ignore:
43+
- dependency-name: "*"
44+
update-types: ["version-update:semver-major"]
45+
46+
# Configuration for npm AdminUI
47+
- package-ecosystem: "npm"
48+
directory: "AdminUI/LearningHub.Nhs.AdminUI/" # Location of package manifests
49+
schedule:
50+
interval: "daily"
51+
target-branch: "Automatic_version_update_dependabot"
52+
# - "dependencies"
53+
open-pull-requests-limit: 10
54+
ignore:
55+
- dependency-name: "*"
56+
update-types: ["version-update:semver-major"]

.github/workflows/auto-merge.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Auto Merge Dependabot PRs
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
13+
jobs:
14+
auto-merge:
15+
runs-on: ubuntu-latest
16+
if: github.actor == 'dependabot[bot]'
17+
18+
steps:
19+
- name: Checkout the repository
20+
uses: actions/checkout@v3
21+
22+
- name: Set up GitHub CLI
23+
run: |
24+
# Install GitHub CLI (gh)
25+
sudo apt-get update
26+
sudo apt-get install gh
27+
28+
# Authenticate GitHub CLI using the provided token
29+
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
30+
31+
- name: Wait for CI workflow to pass (Ensure CI workflow succeeded)
32+
id: wait_for_ci
33+
run: |
34+
# Get the PR number from the GitHub event
35+
PR_NUMBER=${{ github.event.pull_request.number }}
36+
echo "Checking CI status for PR #$PR_NUMBER"
37+
38+
# Define the maximum wait time (in seconds) and the polling interval (in seconds)
39+
MAX_WAIT_TIME=1800 # 30 minutes
40+
POLL_INTERVAL=10 # Check every 10 seconds
41+
42+
# Initialize a timer
43+
elapsed_time=0
44+
45+
# Poll CI status until all checks are completed
46+
while true; do
47+
# Fetch the status check rollup for the PR
48+
CI_STATUS=$(gh pr view $PR_NUMBER --json statusCheckRollup)
49+
50+
# Log the fetched response
51+
echo "CI Status Response: $CI_STATUS"
52+
53+
# Parse the checks and check their status
54+
ALL_COMPLETED=true
55+
ALL_CHECKS_PASSED=true
56+
57+
for check in $(echo "$CI_STATUS" | jq -r '.statusCheckRollup[] | @base64'); do
58+
_jq() {
59+
echo "${check}" | base64 --decode | jq -r "${1}"
60+
}
61+
62+
status=$(_jq '.status')
63+
conclusion=$(_jq '.conclusion')
64+
check_name=$(_jq '.name')
65+
66+
# Log check details
67+
echo "Check: $check_name, Status: $status, Conclusion: $conclusion"
68+
if [[ "$check_name" == "auto-merge" ]]; then
69+
echo "Skipping 'auto-merge' workflow check to prevent self-referencing."
70+
continue
71+
fi
72+
73+
# If any check is still queued, set ALL_COMPLETED to false
74+
if [[ "$status" == "QUEUED" ]]; then
75+
ALL_COMPLETED=false
76+
fi
77+
78+
# If any check is still in progress, set ALL_COMPLETED to false
79+
if [[ "$status" == "IN_PROGRESS" ]]; then
80+
ALL_COMPLETED=false
81+
fi
82+
83+
# If any completed check has failed, set ALL_CHECKS_PASSED to false
84+
if [[ "$status" == "COMPLETED" && "$conclusion" != "SUCCESS" ]]; then
85+
ALL_CHECKS_PASSED=false
86+
fi
87+
done
88+
89+
# Break the loop if all checks are completed
90+
if [[ "$ALL_COMPLETED" == true ]]; then
91+
break
92+
fi
93+
94+
# Wait for the next polling interval
95+
echo "Waiting for checks to complete... ($elapsed_time/$MAX_WAIT_TIME seconds elapsed)"
96+
sleep $POLL_INTERVAL
97+
elapsed_time=$((elapsed_time + POLL_INTERVAL))
98+
99+
# Exit if the maximum wait time is exceeded
100+
if [[ "$elapsed_time" -ge "$MAX_WAIT_TIME" ]]; then
101+
echo "Timed out waiting for CI checks to complete."
102+
exit 1
103+
fi
104+
done
105+
106+
# Final check: Ensure all CI checks passed
107+
if [[ "$ALL_CHECKS_PASSED" == false ]]; then
108+
echo "One or more CI checks failed. Aborting merge."
109+
exit 1
110+
fi
111+
112+
echo "All CI checks passed successfully."
113+
114+
115+
- name: Check Target Branch and PR Title
116+
id: check_branch
117+
run: |
118+
PR_TITLE='${{ github.event.pull_request.title }}'
119+
echo "Original PR Title: $PR_TITLE"
120+
121+
# Escape problematic quotes
122+
ESCAPED_TITLE=$(echo "$PR_TITLE" | sed 's/"/\\"/g')
123+
echo "Escaped PR Title: $ESCAPED_TITLE"
124+
125+
if [[ "$ESCAPED_TITLE" =~ ([0-9]+\.[0-9]+\.[0-9]+).*to.*([0-9]+\.[0-9]+\.[0-9]+) ]]; then
126+
# Extract version numbers
127+
OLD_VERSION="${BASH_REMATCH[1]}"
128+
NEW_VERSION="${BASH_REMATCH[2]}"
129+
echo "Version change detected: $OLD_VERSION to $NEW_VERSION"
130+
131+
# Split version into major, minor, patch components
132+
OLD_MAJOR=$(echo "$OLD_VERSION" | cut -d '.' -f1)
133+
OLD_MINOR=$(echo "$OLD_VERSION" | cut -d '.' -f2)
134+
OLD_PATCH=$(echo "$OLD_VERSION" | cut -d '.' -f3)
135+
136+
NEW_MAJOR=$(echo "$NEW_VERSION" | cut -d '.' -f1)
137+
NEW_MINOR=$(echo "$NEW_VERSION" | cut -d '.' -f2)
138+
NEW_PATCH=$(echo "$NEW_VERSION" | cut -d '.' -f3)
139+
140+
# Check if it's a minor or patch update
141+
if [[ "$OLD_MAJOR" == "$NEW_MAJOR" ]] && [[ "$OLD_MINOR" == "$NEW_MINOR" ]] && [[ "$NEW_PATCH" -gt "$OLD_PATCH" ]]; then
142+
echo "Patch update detected"
143+
echo "should_merge=true" >> $GITHUB_ENV
144+
elif [[ "$OLD_MAJOR" == "$NEW_MAJOR" ]] && [[ "$NEW_MINOR" -gt "$OLD_MINOR" ]]; then
145+
echo "Minor update detected"
146+
echo "should_merge=true" >> $GITHUB_ENV
147+
else
148+
echo "No minor/patch update detected"
149+
echo "should_merge=false" >> $GITHUB_ENV
150+
fi
151+
else
152+
echo "No version change detected"
153+
echo "should_merge=false" >> $GITHUB_ENV
154+
fi
155+
156+
- name: Debug Context
157+
uses: actions/github-script@v6
158+
with:
159+
script: |
160+
console.log("Target branch:", context.payload.pull_request.base.ref);
161+
162+
- name: Check if Should Merge
163+
run: |
164+
echo "DEBUG: should_merge=${{ env.should_merge }}"
165+
if [[ "${{ env.should_merge }}" == "true" ]] && [[ "${{ github.event.pull_request.base.ref }}" == "Automatic_version_update_dependabot" ]]; then
166+
echo "DEBUG: should merge PR"
167+
echo "should_merge=true" >> $GITHUB_ENV
168+
else
169+
echo "DEBUG: skip merge"
170+
echo "should_merge=false" >> $GITHUB_ENV
171+
fi
172+
173+
- name: Merge Pull Request
174+
if: ${{ env.should_merge == 'true' }}
175+
uses: actions/github-script@v6
176+
with:
177+
script: |
178+
github.rest.pulls.merge({
179+
owner: context.repo.owner,
180+
repo: context.repo.repo,
181+
pull_number: context.payload.pull_request.number,
182+
merge_method: "squash"
183+
});

.github/workflows/continuous-integration-workflow.yml

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ jobs:
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: '18'
25-
npm: '6.14.8'
25+
cache: 'npm'
2626

27+
- name: Upgrade npm to the latest version
28+
run: npm install -g [email protected]
29+
2730
- name: Typescript install WebUI
2831
run: yarn install --network-timeout 600000 --frozen-lockfile
2932
working-directory: ./LearningHub.Nhs.WebUI
@@ -43,26 +46,80 @@ jobs:
4346
- name: Setup MSBuild
4447
uses: microsoft/[email protected]
4548

46-
- name: Build SQL Server Database project
49+
- name: Build SQL Server Database Project
4750
run: |
48-
# List all .sqlproj files except for .sqlproj
51+
# Enable strict error handling
52+
$ErrorActionPreference = 'Stop'
53+
54+
# Initialize an error collection
55+
$errors = @()
56+
57+
# List all .sqlproj files
4958
$sqlproj_files = Get-ChildItem -Path . -Filter *.sqlproj -Recurse
50-
51-
# Build each .csproj file
52-
foreach ($sqlproj_file in $sqlproj_files) {
53-
Write-Host "Building $($sqlproj_file.FullName)"
54-
msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release
55-
}
56-
- name: Build solution excluding SQL project
59+
60+
if ($sqlproj_files.Count -eq 0) {
61+
$errors += "No .sqlproj files found."
62+
} else {
63+
foreach ($sqlproj_file in $sqlproj_files) {
64+
Write-Host "Building $($sqlproj_file.FullName)"
65+
try {
66+
$output = &msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release /nologo 2>&1
67+
if (!$?) {
68+
$errors += "Failed to build $($csproj_file.FullName): $output"
69+
}
70+
} catch {
71+
# Capture detailed error information
72+
$errorMessage = "Error building $($sqlproj_file.FullName): $($_.Exception.Message)"
73+
Write-Host $errorMessage
74+
$errors += $errorMessage
75+
}
76+
}
77+
}
78+
79+
# Display all accumulated errors
80+
if ($errors.Count -gt 0) {
81+
Write-Host "SQL Project Build Errors:"
82+
$errors | ForEach-Object { Write-Host $_ }
83+
exit 1
84+
}
85+
86+
- name: Build Solution Excluding SQL Project
5787
run: |
58-
# List all .csproj files except for .sqlproj
88+
# Enable strict error handling
89+
$ErrorActionPreference = 'Stop'
90+
91+
# Initialize an error collection
92+
$errors = @()
93+
94+
# List all .csproj files except .sqlproj
5995
$csproj_files = Get-ChildItem -Path . -Filter *.csproj -Recurse | Where-Object { $_.FullName -notmatch '\\.sqlproj$' }
60-
# Build each .csproj file
61-
foreach ($csproj_file in $csproj_files) {
62-
Write-Host "Building $($csproj_file.FullName)"
63-
dotnet build "$($csproj_file.FullName)"
64-
}
96+
97+
if ($csproj_files.Count -eq 0) {
98+
$errors += "No .csproj files found."
99+
} else {
100+
foreach ($csproj_file in $csproj_files) {
101+
Write-Host "Building $($csproj_file.FullName)"
102+
try {
103+
$output = &dotnet build "$($csproj_file.FullName)" --configuration Release 2>&1
104+
if (!$?) {
105+
$errors += "Failed to build $($csproj_file.FullName): $output"
106+
}
107+
} catch {
108+
# Capture detailed error information
109+
$errorMessage = "Error building $($csproj_file.FullName): $($_.Exception.Message)"
110+
Write-Host $errorMessage
111+
$errors += $errorMessage
112+
}
113+
}
114+
}
65115

116+
# Display all accumulated errors
117+
if ($errors.Count -gt 0) {
118+
Write-Host "Solution Build Errors:"
119+
$errors | ForEach-Object { Write-Host $_ }
120+
exit 1
121+
}
122+
66123
# - name: Test
67124
# run: dotnet test ${{ env.BuildParameters.TestProjects }}
68125

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,29 +87,30 @@
8787
<PackageReference Include="FluentValidation" Version="11.11.0" />
8888
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
8989
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
90-
<PackageReference Include="IdentityModel" Version="4.4.0" />
90+
<PackageReference Include="IdentityModel" Version="4.6.0" />
9191
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
9292
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.46" />
9393
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
94-
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
95-
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
96-
<PackageReference Include="Microsoft.Azure.Management.Media" Version="5.0.0" />
97-
<PackageReference Include="Microsoft.FeatureManagement" Version="3.2.0" />
94+
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.36" />
95+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.36" />
96+
<PackageReference Include="Microsoft.Azure.Management.Media" Version="6.0.0" />
97+
<PackageReference Include="Microsoft.FeatureManagement" Version="4.0.0" />
9898
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.2.0" />
99-
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.9" />
100-
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.2.1" />
101-
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.2.1" />
99+
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.3.0" />
100+
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.3.1" />
101+
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.3.1" />
102102
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.4.1" />
103-
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.5.2">
103+
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.7.1">
104104
<PrivateAssets>all</PrivateAssets>
105105
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
106106
</PackageReference>
107-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
107+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.18" />
108108
<PackageReference Include="MK.IO" Version="1.6.0" />
109109
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
110-
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
110+
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.15" />
111111
<PackageReference Include="System.Data.SqlClient" Version="4.9.0" />
112-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
112+
<PackageReference Include="System.Drawing.Common" Version="9.0.1" />
113+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.1" />
113114
</ItemGroup>
114115
<ItemGroup>
115116
<Folder Include="Properties\" />

0 commit comments

Comments
 (0)