Skip to content

Commit 6aba224

Browse files
authored
Merge pull request #229 from TechnologyEnhancedLearning/master
update
2 parents 5933e7d + 64ccf8c commit 6aba224

7 files changed

+172
-99
lines changed
Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,64 @@
1-
# This script seperate major and minor but we do merge them into the same branch.
2-
# Having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline.
3-
name: Auto-merge Dependabot PRs into collected branch
1+
# qqqq in development
2+
# this script seperate major and minor but we do merge them into the same branch.
3+
# having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline.
4+
name: auto-merge dependabot prs into collected branch
45
on:
56
pull_request:
7+
# synchronize
68
types: [opened, synchronize]
7-
branches: [Automatic_version_update_dependabot] # Make sure this matches your actual branch name
8-
9+
branches: [automatic_version_update_dependabot] # make sure this matches your actual branch name
10+
check_suite:
11+
types: [completed]
12+
workflow_dispatch:
913
permissions:
1014
contents: write
1115
pull-requests: write
16+
checks: read
1217

1318
jobs:
19+
debug:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: debug info
23+
run: |
24+
echo "actor: ${{ github.actor }}"
25+
echo "pr title: ${{ github.event.pull_request.title }}"
26+
echo "target branch: ${{ github.event.pull_request.base.ref }}"
27+
echo "source branch: ${{ github.event.pull_request.head.ref }}"
28+
29+
- name: delay for check
30+
run: |
31+
# drop later qqqq shouldnt need but its running before auto
32+
echo "waiting 4 minutes for other checks to start running..."
33+
sleep 240
34+
1435
auto-merge:
1536
runs-on: ubuntu-latest
16-
if: github.actor == 'dependabot[bot]'
37+
# if dependabot and checks ran
38+
if: (github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch')&& (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success')
1739
steps:
18-
- name: Extract update type
40+
- name: extract update type
1941
id: extract
2042
run: |
21-
PR_TITLE="${{ github.event.pull_request.title }}"
22-
if [[ $PR_TITLE == *"(major)"* ]]; then
23-
echo "update_type=major" >> $GITHUB_OUTPUT
43+
pr_title="${{ github.event.pull_request.title }}"
44+
if [[ $pr_title == *"(major)"* ]]; then
45+
echo "update_type=major" >> $github_output
2446
else
25-
echo "update_type=minor_or_patch" >> $GITHUB_OUTPUT
47+
echo "update_type=minor_or_patch" >> $github_output
2648
fi
2749
28-
- name: Auto-merge minor and patch updates
50+
- name: auto-merge minor and patch updates
2951
if: steps.extract.outputs.update_type == 'minor_or_patch'
30-
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
52+
# auto should set the the request to merge once checks complete
53+
# qqqq could squash for cleaner? --squash "${{ github.event.pull_request.html_url }}"
54+
run: gh pr merge --auto 1
3155
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
3357

34-
- name: Auto-merge major updates
58+
- name: auto-merge major updates
3559
if: steps.extract.outputs.update_type == 'major'
36-
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
60+
# auto should set the the request to merge once checks complete
61+
# qqqq could squash for cleaner? --squash "${{ github.event.pull_request.html_url }}"
62+
run: gh pr merge --auto 1
3763
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
11
name: Collected Dependabot Promotion From Staging To Master
22
on:
3-
schedule:
4-
# we want the opposite weeks to staging so we get a week where it occurs in manual testing
5-
- cron: '0 9 8-14 * 1' # Second Monday of month
6-
- cron: '0 9 22-28 * 1' # Fourth Monday of month
73
workflow_dispatch:
4+
# # qqqq in development
5+
# name: Collected Dependabot Promotion From Staging To Master
6+
# on:
7+
# schedule:
8+
# # we want the opposite weeks to staging so we get a week where it occurs in manual testing
9+
# - cron: '0 9 8-14 * 1' # Second Monday of month
10+
# - cron: '0 9 22-28 * 1' # Fourth Monday of month
11+
# workflow_dispatch:
812

9-
jobs:
10-
promote-to-master:
11-
runs-on: ubuntu-latest
12-
permissions:
13-
contents: write
14-
pull-requests: write
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
13+
# jobs:
14+
# promote-to-master:
15+
# runs-on: ubuntu-latest
16+
# permissions:
17+
# contents: write
18+
# pull-requests: write
19+
# steps:
20+
# - name: Checkout
21+
# uses: actions/checkout@v4
22+
# with:
23+
# fetch-depth: 0
2024

21-
- name: Check for changes
22-
id: changes
23-
run: |
24-
git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
25-
git fetch origin master:master # or main/master - whatever your prod branch is
25+
# - name: Check for changes
26+
# id: changes
27+
# run: |
28+
# git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
29+
# git fetch origin master:master
2630

27-
if git diff --quiet master Automatic_collected_dependabot_staging; then
28-
echo "has_changes=false" >> $GITHUB_OUTPUT
29-
else
30-
echo "has_changes=true" >> $GITHUB_OUTPUT
31-
fi
31+
# if git diff --quiet master Automatic_collected_dependabot_staging; then
32+
# echo "has_changes=false" >> $GITHUB_OUTPUT
33+
# else
34+
# echo "has_changes=true" >> $GITHUB_OUTPUT
35+
# fi
3236

33-
- name: Create PR to master
34-
if: steps.changes.outputs.has_changes == 'true'
35-
run: |
36-
if gh pr list --head Automatic_collected_dependabot_staging --base master --json number --jq '.[0].number' | grep -q .; then
37-
echo "PR already exists, skipping creation"
38-
else
39-
gh pr create \
40-
--base master \
41-
--head Automatic_collected_dependabot_staging \
42-
--title "Fortnightly dependabot collected master promotion - $(date +%Y-%m-%d)" \
43-
--body "Automated weekly promotion from staging to master after testing period" \
44-
--auto-merge \
45-
--merge
46-
fi
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
# - name: Create PR to master
38+
# if: steps.changes.outputs.has_changes == 'true'
39+
# run: |
40+
# if gh pr list --head Automatic_collected_dependabot_staging --base master --json number --jq '.[0].number' | grep -q .; then
41+
# echo "PR already exists, skipping creation"
42+
# else
43+
# gh pr create \
44+
# --base master \
45+
# --head Automatic_collected_dependabot_staging \
46+
# --title "Fortnightly dependabot collected master promotion - $(date +%Y-%m-%d)" \
47+
# --body "Automated weekly promotion from staging to master after testing period" \
48+
# --auto-merge \
49+
# --merge
50+
# fi
51+
# env:
52+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1+
# # qqqq in development
12
name: Dependabot Collected Promotion To Staging
2-
# this logic will require branch ruleset checks of running the dev pipeline
33
on:
4-
schedule:
5-
# Promotion from staging to release should be a week apart so alternating weeks (also live updates dangerous)
6-
- cron: '0 9 1-7 * 1' # First Monday of month
7-
- cron: '0 9 15-21 * 1' # Third Monday of month
8-
workflow_dispatch: # Allow manual trigger
4+
workflow_dispatch:
5+
# name: Dependabot Collected Promotion To Staging
6+
# # this logic will require branch ruleset checks of running the dev pipeline
7+
# on:
8+
# schedule:
9+
# # Promotion from staging to release should be a week apart so alternating weeks (also live updates dangerous)
10+
# - cron: '0 9 1-7 * 1' # First Monday of month
11+
# - cron: '0 9 15-21 * 1' # Third Monday of month
12+
# workflow_dispatch: # Allow manual trigger
913

10-
jobs:
11-
promote-to-automatic-collected-dependabot-staging:
12-
runs-on: ubuntu-latest
13-
permissions:
14-
contents: write
15-
pull-requests: write
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
14+
# jobs:
15+
# promote-to-automatic-collected-dependabot-staging:
16+
# runs-on: ubuntu-latest
17+
# permissions:
18+
# contents: write
19+
# pull-requests: write
20+
# steps:
21+
# - name: Checkout
22+
# uses: actions/checkout@v4
23+
# with:
24+
# fetch-depth: 0
2125

22-
- name: Check for changes
23-
id: changes
24-
run: |
25-
git fetch origin Automatic_version_update_dependabot:Automatic_version_update_dependabot
26-
git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
26+
# - name: Check for changes
27+
# id: changes
28+
# run: |
29+
# git fetch origin Automatic_version_update_dependabot:Automatic_version_update_dependabot
30+
# git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
2731

28-
if git diff --quiet Automatic_collected_dependabot_staging Automatic_version_update_dependabot; then
29-
echo "has_changes=false" >> $GITHUB_OUTPUT
30-
else
31-
echo "has_changes=true" >> $GITHUB_OUTPUT
32-
fi
32+
# if git diff --quiet Automatic_collected_dependabot_staging Automatic_version_update_dependabot; then
33+
# echo "has_changes=false" >> $GITHUB_OUTPUT
34+
# else
35+
# echo "has_changes=true" >> $GITHUB_OUTPUT
36+
# fi
3337

34-
- name: Create PR to Automatic_collected_dependabot_staging
35-
if: steps.changes.outputs.has_changes == 'true'
36-
run: |
37-
gh pr create \
38-
--base Automatic_collected_dependabot_staging \
39-
--head Automatic_version_update_dependabot \
40-
--title "Fortnightly dependabot collected to staging - $(date +%Y-%m-%d)" \
41-
--body "Automated Fortnightly promotion of dependency updates from dependabot" \
42-
--auto-merge \
43-
--merge
44-
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
# - name: Create PR to Automatic_collected_dependabot_staging
39+
# if: steps.changes.outputs.has_changes == 'true'
40+
# run: |
41+
# gh pr create \
42+
# --base Automatic_collected_dependabot_staging \
43+
# --head Automatic_version_update_dependabot \
44+
# --title "Fortnightly dependabot collected to staging - $(date +%Y-%m-%d)" \
45+
# --body "Automated Fortnightly promotion of dependency updates from dependabot" \
46+
# --auto-merge \
47+
# --merge
48+
# env:
49+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reuseable-ci-checks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ jobs:
340340
# Echo the entire artifact list for debugging purposes
341341
echo "Artifact List: $ARTIFACT_LIST"
342342
343-
ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[] | select(.name=="coverage-report") | .url')
343+
#qqqq worked mostly ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[] | select(.name=="coverage-report") | .url')
344+
ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts | map(select(.name=="coverage-report")) | sort_by(.created_at) | last | .url')
345+
344346
345347
# Echo the artifact URL to confirm
346348
echo "Artifact URL: $ARTIFACT_URL"

.github/workflows/workflow-readme.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,43 @@ The individual steps also automatically pass so can see if any error at the end
8585
- autoverging is being tried for major and minor
8686
- branch checks must pass for merge on automated_version
8787
- checks required but overrideable for all workflows
88+
- dependabot secret names to match repos ones where need to share
89+
- dependabot not need to build package later brnch does
90+
91+
## Dependabot Pipeline (AI generatated diag)
92+
93+
```mermaid
94+
flowchart TD
95+
%% Dependabot PR to initial branch
96+
A[Dependabot PR] --> B[Automatic_version_update_dependabot]
97+
98+
%% Checks on the dependabot branch
99+
B --> C[Run Checks]
100+
C --> C1[Commit name check ❌ skipped]
101+
C --> C2[Branch name check ❌ skipped]
102+
C --> C3[Build as release]
103+
C --> C4[Unit tests]
104+
C --> C5[E2E tests]
105+
106+
%% Weekly merge to staging
107+
B -->|Weekly merge via collected-dependabot-to-staging.yml| D[Automatic_collected_dependabot_staging]
108+
109+
%% Staging checks and dev build
110+
D --> E[Run Checks & Dev Build]
111+
E --> E1[Checks again]
112+
E --> E2[Build dev package]
113+
E --> E3[Showcase dev page]
114+
115+
%% Weekly merge to master
116+
D -->|Weekly merge via collected-dependabot-staging-to-master.yml| F[Master]
117+
```
118+
88119
## Versioning
89120
Via semantic release and recorded as a generate c# file used by a blazor component
90121

91122
## Alternative Approaches
92123

93-
```
124+
94125
name: Pull Request Checks
95126

96127
# ⚠️ pull_request_target is dangerous it allows secrets to be used by forks and bots, ⚠️

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,4 @@ TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/Logs/*
237237
# Generated version info files
238238
TELBlazor.Components/TELBlazorPackageVersion/VersionInfo*.cs
239239
/.github/workflows/test.yml
240+
/Optimisation Notes.md

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ the ability to produce static prerendered html. The prerendered html is written
4848
- **Node.js 18+** and npm
4949
- **Git** configured with your credentials
5050
- **PowerShell 5.1+**
51+
- **Longfile names enabled on the system**
5152
> ⚠️ **Important:** All commands in this guide require **PowerShell running as Administrator**
5253
5354
### Quick Setup ⚡
@@ -116,6 +117,10 @@ The project should now work. See other sections for what projects to run, and co
116117

117118
> ⚠️ read the contribution section before creating a branch or commits ⚠️
118119
120+
### Trouble Shooting
121+
- Longpaths may be required if E2E Client is not building.
122+
- Follow [microsoft docs](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry)
123+
- or Win + R -> type regedit -> path to the option HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem -> set LongPathsEnabled to 1
119124

120125
### Getting Started with the Project following Setup
121126

0 commit comments

Comments
 (0)