From 350c6c76fe821e561b8e1c42869c6a2852523c60 Mon Sep 17 00:00:00 2001 From: Farshad DASHTI Date: Tue, 1 Oct 2024 17:25:43 +0100 Subject: [PATCH] Updated variables --- .github/workflows/build-test-caching.yml | 3 +++ .github/workflows/build-test-template.yml | 15 ++++++++++----- .../ServiceCollectionExtensions.cs | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-caching.yml b/.github/workflows/build-test-caching.yml index ee88df0..7787464 100644 --- a/.github/workflows/build-test-caching.yml +++ b/.github/workflows/build-test-caching.yml @@ -14,3 +14,6 @@ jobs: project_name: DfE.CoreLibs.Caching project_path: src/DfE.CoreLibs.Caching sonar_project_key: DFE-Digital_corelibs-caching + secrets: + GITHUB__TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR__TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/build-test-template.yml b/.github/workflows/build-test-template.yml index 616958c..3656f3a 100644 --- a/.github/workflows/build-test-template.yml +++ b/.github/workflows/build-test-template.yml @@ -15,6 +15,11 @@ on: required: true type: string description: "SonarCloud project key" + secrets: + GITHUB__TOKEN: + required: true + SONAR__TOKEN: + required: true env: DOTNET_VERSION: '8.0.x' @@ -61,20 +66,20 @@ jobs: run: dotnet tool install --global dotnet-reportgenerator-globaltool - name: Add nuget package source - run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json" + run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB__TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json" - name: Restore dependencies run: dotnet restore ${{ inputs.project_path }} - name: Build, Test and Analyze env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB__TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR__TOKEN }} ConnectionStrings__DefaultConnection: ${{ env.CONNECTION_STRING }} CI: true run: | - dotnet-sonarscanner begin /k:"${{ inputs.sonar_project_key }}" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml + dotnet-sonarscanner begin /k:"${{ inputs.sonar_project_key }}" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR__TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml dotnet build --no-restore -p:CI=${CI} ${{ inputs.project_path }} dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" ${{ inputs.project_path }} reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:SonarQube - dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR__TOKEN }}" diff --git a/src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs b/src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs index c688d21..f621eef 100644 --- a/src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs +++ b/src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs @@ -3,6 +3,7 @@ using DfE.CoreLibs.Caching.Settings; using Microsoft.Extensions.Configuration; + namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions @@ -16,4 +17,4 @@ public static IServiceCollection AddServiceCaching( return services; } } -} \ No newline at end of file +}