Skip to content

Commit 7a69c02

Browse files
authored
Merge pull request #157 from TechnologyEnhancedLearning/master
update auto to get cicd
2 parents d728264 + 9485123 commit 7a69c02

File tree

5 files changed

+85
-12
lines changed

5 files changed

+85
-12
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
version: 2
2+
registries:
3+
nuget-org:
4+
type: nuget-feed
5+
url: https://api.nuget.org/v3/index.json
6+
github-nuget-feed:
7+
type: nuget-feed
8+
# Dependabot needs access before it ignores, so still need to access TELBlazor despite ignoring it
9+
url: https://nuget.pkg.github.com/TechnologyEnhancedLearning/index.json
10+
token: ${{ secrets.DEPENDABOT_GIT_PACKAGES_TOKEN }}
11+
212
updates:
313
- package-ecosystem: "nuget"
414
directory: "/"
15+
registries:
16+
- nuget-org
17+
- github-nuget-feed
518
schedule:
619
interval: "daily"
720
open-pull-requests-limit: 100
821
target-branch: "Automatic_version_update_dependabot"
9-
22+
rebase-strategy: "auto"
23+
ignore:
24+
# The cicd for TELBlazor manages the version to consume for showcase consuming the package
25+
- dependency-name: "TELBlazor.Components"
26+
versions: ["*"]
1027
- package-ecosystem: "npm"
1128
directory: "/"
1229
schedule:
1330
interval: "daily"
1431
open-pull-requests-limit: 100
1532
target-branch: "Automatic_version_update_dependabot"
16-
17-
33+
rebase-strategy: "auto"

.github/workflows/dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929

3030
dev-call-reusable-ci-checks-workflow:
3131
name: Dev Run CI checks
32+
# Not using @master so it uses its own check rules
3233
uses: ./.github/workflows/reuseable-ci-checks.yml
3334
with:
3435
runall: true

.github/workflows/pull_request.yml

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

1515
pull-request-call-reusable-ci-checks-workflow:
1616
name: Pull Request run CI Checks
17-
uses: ./.github/workflows/reuseable-ci-checks.yml
17+
uses: ./.github/workflows/reuseable-ci-checks.yml@master
1818
needs: dummy
1919
with:
2020
runall: true

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

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ env:
4343
# Nuget Set Up
4444
NUGET_PACKAGES_OUTPUT_PATH: ${{ github.workspace }}/CICDPackageLocation
4545
LOCAL_PACKAGES_PATH: ${{ github.workspace }}/CICDPackageLocation
46+
GITHUB_USERNAME: "Phil-NHS"
4647

4748
# Build Set Up
4849
# May need coverlet.collector xplat if using the packaged version to test
@@ -79,6 +80,8 @@ jobs:
7980
- name: Replace local environment variable in nuget config because cant provide it as a parameter
8081
run: |
8182
sed -i "s|%TEL_BLAZOR_PACKAGE_SOURCE%|$LOCAL_PACKAGES_PATH|g" nuget.config
83+
sed -i "s|%GITHUB_USERNAME%|$GITHUB_USERNAME|g" nuget.config
84+
sed -i "s|%TEL_GIT_PACKAGES_TOKEN%|$TEL_GIT_PACKAGES_TOKEN|g" nuget.config
8285
8386
- name: Create appsettings development from secrets
8487
run: |
@@ -139,21 +142,59 @@ jobs:
139142
outputs:
140143
status: ${{ job.status }}
141144
runs-on: ubuntu-latest
145+
142146
steps:
147+
# Checkout so can get access to the file
148+
- name: Checkout repository
149+
uses: actions/checkout@v4
150+
143151
- name: Validate Branch Name
144152
run: |
153+
145154
#BRANCH_NAME="${GITHUB_HEAD_REF}"
146155
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
147156
echo "Validating branch name: $BRANCH_NAME"
157+
158+
# Read allowed branch patterns from .releaserc.json
159+
RELEASERC_PATH="${{ github.workspace }}/.releaserc.json"
160+
echo "Using releaserc at: $RELEASERC_PATH"
161+
ALLOWED_BRANCHES=$(jq -r '.branches[].name' $RELEASERC_PATH)
162+
163+
VALID=false
164+
for pattern in $ALLOWED_BRANCHES; do
165+
# Convert wildcard * into regex
166+
REGEX="^${pattern//\*/.*}$"
167+
if [[ "$BRANCH_NAME" =~ $REGEX ]]; then
168+
VALID=true
169+
break
170+
fi
171+
done
172+
173+
# Always allow dependabot branches for CI
174+
# Semver will ignore the branch but will bump the collected dependabot changes branch
175+
if [[ "$BRANCH_NAME" =~ ^dependabot/ ]]; then
176+
echo "✅ Branch is a dependabot branch its not for release or versioning but for merging into the dependabot collection branch"
177+
VALID=true
178+
fi
148179
149-
if [[ "$BRANCH_NAME" =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|sample|security|config|bugfix|hotfix)-[a-zA-Z0-9._/-]+$ ]] || [[ "$BRANCH_NAME" == "master" ]]; then
180+
if [ "$VALID" = true ]; then
150181
echo "✅ Branch name is valid"
151182
else
152183
echo "❌ Invalid branch name: $BRANCH_NAME"
153-
echo "Branch names must follow one of the allowed prefixes:"
154-
echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*"
184+
echo "Allowed branch patterns:"
185+
echo "$ALLOWED_BRANCHES"
155186
exit 1
156187
fi
188+
189+
# qqqq drop
190+
# if [[ "$BRANCH_NAME" =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|sample|security|config|bugfix|hotfix)-[a-zA-Z0-9._/-]+$ ]] || [[ "$BRANCH_NAME" == "master" ]]; then
191+
# echo "✅ Branch name is valid"
192+
# else
193+
# echo "❌ Invalid branch name: $BRANCH_NAME"
194+
# echo "Branch names must follow one of the allowed prefixes:"
195+
# echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*"
196+
# exit 1
197+
# fi
157198

158199

159200
reuseable-ci-checks-commitlint:
@@ -164,11 +205,24 @@ jobs:
164205
outputs:
165206
status: ${{ job.status }}
166207
steps:
167-
- uses: actions/checkout@v4
208+
- name: Checkout repository
209+
uses: actions/checkout@v4
168210
with:
169211
fetch-depth: 0
170-
171-
- uses: wagoid/commitlint-github-action@v5
212+
213+
- name: Check branch and run commitlint
214+
run: |
215+
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
216+
echo "Branch name: $BRANCH_NAME"
217+
if [[ "$BRANCH_NAME" =~ ^dependabot/ ]]; then
218+
echo "✅ Branch is a dependabot branch - skipping commitlint"
219+
exit 0
220+
else
221+
echo "Regular branch - will run commitlint in next step"
222+
fi
223+
224+
- name: Run commitlint action
225+
uses: wagoid/commitlint-github-action@v5
172226
with:
173227
configFile: .commitlintrc.json
174228
# Only set from/to if inputs are provided, otherwise let action use defaults
@@ -200,6 +254,8 @@ jobs:
200254
- name: Replace local environment variable in nuget config because cant provide it as a parameter
201255
run: |
202256
sed -i "s|%TEL_BLAZOR_PACKAGE_SOURCE%|$LOCAL_PACKAGES_PATH|g" nuget.config
257+
sed -i "s|%GITHUB_USERNAME%|$GITHUB_USERNAME|g" nuget.config
258+
sed -i "s|%TEL_GIT_PACKAGES_TOKEN%|$TEL_GIT_PACKAGES_TOKEN|g" nuget.config
203259
204260
- name: Clean lock files because the newly generated package file will superseed the locks
205261
run: |

nuget.config.cicd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
33
4-
This config is replaces nuget.config in cicd.
5-
It provides credentials incase the TEL git packages feed is used.
4+
This config is replaces nuget.config in cicd.
5+
It provides credentials incase the TEL git packages feed is used.
66
77
-->
88
<configuration>

0 commit comments

Comments
 (0)