From 2be0d0d5f607c745d10e4d5e16d734eeba74678f Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 13:56:10 +0100 Subject: [PATCH 1/7] chore(dependabot): releaserc to be used in checks and dependabot not to be failed by it --- .github/dependabot.yml | 4 +-- .github/workflows/reuseable-ci-checks.yml | 36 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4c9eac2..cfd723d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,6 +6,7 @@ updates: interval: "daily" open-pull-requests-limit: 100 target-branch: "Automatic_version_update_dependabot" + rebase-strategy: "auto" - package-ecosystem: "npm" directory: "/" @@ -13,5 +14,4 @@ updates: interval: "daily" open-pull-requests-limit: 100 target-branch: "Automatic_version_update_dependabot" - - + rebase-strategy: "auto" \ No newline at end of file diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index 2a2353e..2d455e8 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -145,15 +145,45 @@ jobs: #BRANCH_NAME="${GITHUB_HEAD_REF}" BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" echo "Validating branch name: $BRANCH_NAME" + + # Read allowed branch patterns from .releaserc.json + ALLOWED_BRANCHES=$(jq -r '.branches[].name' .releaserc.json) + + VALID=false + for pattern in $ALLOWED_BRANCHES; do + # Convert wildcard * into regex + REGEX="^${pattern//\*/.*}$" + if [[ "$BRANCH_NAME" =~ $REGEX ]]; then + VALID=true + break + fi + done + + # Always allow dependabot branches for CI + # Semver will ignore the branch but will bump the collected dependabot changes branch + if [[ "$BRANCH_NAME" =~ ^dependabot/ ]]; then + echo "✅ Branch is a dependabot branch its not for release or versioning but for merging into the dependabot collection branch" + VALID=true + fi - 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 + if [ "$VALID" = true ]; then echo "✅ Branch name is valid" else echo "❌ Invalid branch name: $BRANCH_NAME" - echo "Branch names must follow one of the allowed prefixes:" - echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*" + echo "Allowed branch patterns:" + echo "$ALLOWED_BRANCHES" exit 1 fi + + # qqqq drop + # 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 + # echo "✅ Branch name is valid" + # else + # echo "❌ Invalid branch name: $BRANCH_NAME" + # echo "Branch names must follow one of the allowed prefixes:" + # echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*" + # exit 1 + # fi reuseable-ci-checks-commitlint: From 3256a8f6f639d67ba7f586728bfa2647b1c88b01 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 14:03:51 +0100 Subject: [PATCH 2/7] chore(reuseable): File loc error --- .github/workflows/reuseable-ci-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index 2d455e8..e108d29 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -147,7 +147,7 @@ jobs: echo "Validating branch name: $BRANCH_NAME" # Read allowed branch patterns from .releaserc.json - ALLOWED_BRANCHES=$(jq -r '.branches[].name' .releaserc.json) + ALLOWED_BRANCHES=$(jq -r '.branches[].name' "$GITHUB_WORKSPACE/.releaserc.json) VALID=false for pattern in $ALLOWED_BRANCHES; do From 291579d6f35c04c941bf065a5da0701be10551ab Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 14:13:24 +0100 Subject: [PATCH 3/7] chore(dependabot): fix --- .github/workflows/reuseable-ci-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index e108d29..bf7039d 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -147,7 +147,7 @@ jobs: echo "Validating branch name: $BRANCH_NAME" # Read allowed branch patterns from .releaserc.json - ALLOWED_BRANCHES=$(jq -r '.branches[].name' "$GITHUB_WORKSPACE/.releaserc.json) + ALLOWED_BRANCHES=$(jq -r '.branches[].name' "$GITHUB_WORKSPACE/.releaserc.json") VALID=false for pattern in $ALLOWED_BRANCHES; do From 921837a2859800a739c5ed029471961d890315d1 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 14:37:58 +0100 Subject: [PATCH 4/7] chore(dependancy): Not finding file --- .github/workflows/reuseable-ci-checks.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index bf7039d..dd0e39a 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -142,12 +142,24 @@ jobs: steps: - name: Validate Branch Name run: | + echo "📂 GITHUB_WORKSPACE is: $GITHUB_WORKSPACE" + echo "📂 Current working directory is: $(pwd)" + echo "📂 Listing files in current dir:" + ls -alh + echo "📂 Listing files in workspace root:" + ls -alh "$GITHUB_WORKSPACE" + #BRANCH_NAME="${GITHUB_HEAD_REF}" BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" echo "Validating branch name: $BRANCH_NAME" # Read allowed branch patterns from .releaserc.json - ALLOWED_BRANCHES=$(jq -r '.branches[].name' "$GITHUB_WORKSPACE/.releaserc.json") + + + + RELEASERC_PATH="${{ github.workspace }}/.releaserc.json" + echo "Using releaserc at: $RELEASERC_PATH" + ALLOWED_BRANCHES=$(jq -r '.branches[].name' $RELEASERC_PATH) VALID=false for pattern in $ALLOWED_BRANCHES; do From a04553c555a6a350f08a6a7871e5120d1de600d5 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 14:47:53 +0100 Subject: [PATCH 5/7] chore(release): check --- .github/workflows/reuseable-ci-checks.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index dd0e39a..95e285b 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -139,12 +139,18 @@ jobs: outputs: status: ${{ job.status }} runs-on: ubuntu-latest + + # Checkout so can get access to the file + - name: Checkout repository + uses: actions/checkout@v4 + steps: - name: Validate Branch Name run: | echo "📂 GITHUB_WORKSPACE is: $GITHUB_WORKSPACE" echo "📂 Current working directory is: $(pwd)" echo "📂 Listing files in current dir:" + ls ls -alh echo "📂 Listing files in workspace root:" ls -alh "$GITHUB_WORKSPACE" From 54bd5dc0c6c85653a999f615393a9b6df276da1e Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 14:54:50 +0100 Subject: [PATCH 6/7] chore(yaml): fix yaml --- .github/workflows/reuseable-ci-checks.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index 95e285b..0fd9cca 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -140,11 +140,13 @@ jobs: status: ${{ job.status }} runs-on: ubuntu-latest - # Checkout so can get access to the file - - name: Checkout repository - uses: actions/checkout@v4 + steps: + # Checkout so can get access to the file + - name: Checkout repository + uses: actions/checkout@v4 + - name: Validate Branch Name run: | echo "📂 GITHUB_WORKSPACE is: $GITHUB_WORKSPACE" From b17b8a8c4200f649419d14ac02f8353537e3bb36 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Tue, 26 Aug 2025 15:35:05 +0100 Subject: [PATCH 7/7] chore(punt): not hopefull but try completing nuget substitions --- .github/workflows/reuseable-ci-checks.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index 0fd9cca..28611f4 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -43,6 +43,7 @@ env: # Nuget Set Up NUGET_PACKAGES_OUTPUT_PATH: ${{ github.workspace }}/CICDPackageLocation LOCAL_PACKAGES_PATH: ${{ github.workspace }}/CICDPackageLocation + GITHUB_USERNAME: "Phil-NHS" # Build Set Up # May need coverlet.collector xplat if using the packaged version to test @@ -79,6 +80,8 @@ jobs: - name: Replace local environment variable in nuget config because cant provide it as a parameter run: | sed -i "s|%TEL_BLAZOR_PACKAGE_SOURCE%|$LOCAL_PACKAGES_PATH|g" nuget.config + sed -i "s|%GITHUB_USERNAME%|$GITHUB_USERNAME|g" nuget.config + sed -i "s|%TEL_GIT_PACKAGES_TOKEN%|$TEL_GIT_PACKAGES_TOKEN|g" nuget.config - name: Create appsettings development from secrets run: | @@ -149,22 +152,12 @@ jobs: - name: Validate Branch Name run: | - echo "📂 GITHUB_WORKSPACE is: $GITHUB_WORKSPACE" - echo "📂 Current working directory is: $(pwd)" - echo "📂 Listing files in current dir:" - ls - ls -alh - echo "📂 Listing files in workspace root:" - ls -alh "$GITHUB_WORKSPACE" #BRANCH_NAME="${GITHUB_HEAD_REF}" BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" echo "Validating branch name: $BRANCH_NAME" # Read allowed branch patterns from .releaserc.json - - - RELEASERC_PATH="${{ github.workspace }}/.releaserc.json" echo "Using releaserc at: $RELEASERC_PATH" ALLOWED_BRANCHES=$(jq -r '.branches[].name' $RELEASERC_PATH) @@ -250,6 +243,8 @@ jobs: - name: Replace local environment variable in nuget config because cant provide it as a parameter run: | sed -i "s|%TEL_BLAZOR_PACKAGE_SOURCE%|$LOCAL_PACKAGES_PATH|g" nuget.config + sed -i "s|%GITHUB_USERNAME%|$GITHUB_USERNAME|g" nuget.config + sed -i "s|%TEL_GIT_PACKAGES_TOKEN%|$TEL_GIT_PACKAGES_TOKEN|g" nuget.config - name: Clean lock files because the newly generated package file will superseed the locks run: |