From f01fbcabc1bbc0e0cea22e7cd1db921d11995202 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Tue, 28 Oct 2025 14:50:18 +0300 Subject: [PATCH 01/16] addded workflow pr-verify --- .github/workflows/pr-verify.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/pr-verify.yml diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml new file mode 100644 index 00000000..635e5d8b --- /dev/null +++ b/.github/workflows/pr-verify.yml @@ -0,0 +1,22 @@ +name: PR Verify + +on: + pull_request: + branches: [ "main" ] + +jobs: + build: + name: PR Verify + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0 + + + - name: Build with dotnet + run: dotnet build --configuration Release \ No newline at end of file From c214c6ede9ed514ac484e54b589178ed8d19bf53 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Tue, 28 Oct 2025 14:54:56 +0300 Subject: [PATCH 02/16] added new lines --- .../Models/WeatherForecastTests.cs | 2 ++ src/GitHubActionsDotNet.Api/Program.cs | 1 + src/GitHubActionsDotNet.Api/appsettings.json | 1 + 3 files changed, 4 insertions(+) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index f03d0f47..43357c93 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -14,4 +14,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() weatherForecast.TemperatureF.Should().Be(32); } + } + diff --git a/src/GitHubActionsDotNet.Api/Program.cs b/src/GitHubActionsDotNet.Api/Program.cs index 48863a6d..303f498f 100644 --- a/src/GitHubActionsDotNet.Api/Program.cs +++ b/src/GitHubActionsDotNet.Api/Program.cs @@ -1,6 +1,7 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. +// No services to add yet to the program file builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle diff --git a/src/GitHubActionsDotNet.Api/appsettings.json b/src/GitHubActionsDotNet.Api/appsettings.json index 10f68b8c..fb878503 100644 --- a/src/GitHubActionsDotNet.Api/appsettings.json +++ b/src/GitHubActionsDotNet.Api/appsettings.json @@ -7,3 +7,4 @@ }, "AllowedHosts": "*" } + From 8b4d17a6db1f133c88f4970c587c44c1cbfbcefa Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Tue, 28 Oct 2025 15:41:39 +0300 Subject: [PATCH 03/16] updated workflow with tests --- .github/workflows/pr-verify.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 635e5d8b..d47e7b3c 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -19,4 +19,7 @@ jobs: - name: Build with dotnet - run: dotnet build --configuration Release \ No newline at end of file + run: dotnet build --configuration Release + + - name: Run Tests + run: dotnet test --configuration Release --no-build \ No newline at end of file From eb602c823c41d198e9cea6a4f7a41f1be8f5d26c Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Tue, 28 Oct 2025 16:28:22 +0300 Subject: [PATCH 04/16] added format to the workflow --- .github/workflows/pr-verify.yml | 5 ++++- src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj | 2 +- src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs | 4 ++-- src/GitHubActionsDotNet.Api/appsettings.Development.json | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index d47e7b3c..4d3cb722 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -22,4 +22,7 @@ jobs: run: dotnet build --configuration Release - name: Run Tests - run: dotnet test --configuration Release --no-build \ No newline at end of file + run: dotnet test --configuration Release --no-build + + - name: Run formatter + run: dotnet format -v detailed --verify-no-changes diff --git a/src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj b/src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj index f18b2634..9df2ee32 100644 --- a/src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj +++ b/src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj @@ -7,7 +7,7 @@ true - + diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 786b4a10..542f7b5d 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -6,7 +6,7 @@ public record WeatherForecast public int TemperatureC { get; init; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; init; } + public string? Summary { get; init; } } diff --git a/src/GitHubActionsDotNet.Api/appsettings.Development.json b/src/GitHubActionsDotNet.Api/appsettings.Development.json index 0c208ae9..d4049d44 100644 --- a/src/GitHubActionsDotNet.Api/appsettings.Development.json +++ b/src/GitHubActionsDotNet.Api/appsettings.Development.json @@ -1,8 +1,8 @@ { "Logging": { "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Default": "Information", + "Microsoft.AspNetCore": "Warning" } } } From 440072628bdf52617eb236f82a911a6ca04870b2 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Wed, 29 Oct 2025 14:24:21 +0300 Subject: [PATCH 05/16] fixed formatting --- .../Models/WeatherForecastTests.cs | 2 +- src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index 43357c93..420d0370 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -14,6 +14,6 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() weatherForecast.TemperatureF.Should().Be(32); } - + } diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 542f7b5d..786b4a10 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -6,7 +6,7 @@ public record WeatherForecast public int TemperatureC { get; init; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; init; } + public string? Summary { get; init; } } From 25d319d8d622cf70281c0ace24b253abfa66b9c9 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Thu, 30 Oct 2025 15:07:58 +0300 Subject: [PATCH 06/16] changed formatting --- src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 786b4a10..355fa892 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -4,9 +4,9 @@ public record WeatherForecast { public DateOnly Date { get; init; } - public int TemperatureC { get; init; } + public int TemperatureC { get; init; } public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; init; } + public string? Summary { get; init; } } From 0477b4ece084d83b3622a8d80a9671b112c0e7ed Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Mon, 3 Nov 2025 14:07:35 +0300 Subject: [PATCH 07/16] updated workflows --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/cron.yml | 14 ++++++++++++++ .github/workflows/pr-verify.yml | 25 ++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..bd0e8e5f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI Workflow + +on: + push: + branches: [ "main" ] + +jobs: + build: + name: CI Workflow + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0 + + - name: Run Tests + run: dotnet test --configuration Release + + - name: Publish Artifact + working-directory: src + run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts + + - uses: actions/upload-artifact@v4 + with: + name: my-artifact + path: artifacts/ diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 00000000..dda63868 --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,14 @@ +name: Cron job to run every 5 minutes +# cron jobs like do security scans after a specified period of time +on: + schedule: + - cron: '*/5 * * * *' + +jobs: + cron: + name: Run every 5 minutes + runs-on: ubuntu-latest + + steps: + - name: Say Hello World + run: echo "hello world" diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 4d3cb722..012d6fcd 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -2,27 +2,46 @@ name: PR Verify on: pull_request: - branches: [ "main" ] + # Trigger on PRs targeting develop and main + branches: [ "develop", "main" ] jobs: build: name: PR Verify runs-on: ubuntu-latest + # Give the job explicit write permissions so it can push a commit + permissions: + contents: write steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0 - - name: Build with dotnet run: dotnet build --configuration Release - name: Run Tests run: dotnet test --configuration Release --no-build + + - name: Run formatter - run: dotnet format -v detailed --verify-no-changes + run: dotnet format --configuration Release + + - name: Commit formatting changes and push + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: Apply automatic dotnet format changes" + + commit_author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' + + # NOTE: No separate 'Run formatter' check is needed now. + # If the tests pass and the auto-commit succeeds (or has nothing to commit), + # the PR is considered verified and ready to merge (assuming branch protection is set). \ No newline at end of file From fc4ad881282d8e6357209d621957a16b5bf5b8e8 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Mon, 3 Nov 2025 14:11:50 +0300 Subject: [PATCH 08/16] updated workflows format command --- .github/workflows/pr-verify.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 012d6fcd..4d88988b 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -33,7 +33,7 @@ jobs: - name: Run formatter - run: dotnet format --configuration Release + run: dotnet format -v detailed --verify-no-changes - name: Commit formatting changes and push uses: stefanzweifel/git-auto-commit-action@v5 @@ -42,6 +42,3 @@ jobs: commit_author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' - # NOTE: No separate 'Run formatter' check is needed now. - # If the tests pass and the auto-commit succeeds (or has nothing to commit), - # the PR is considered verified and ready to merge (assuming branch protection is set). \ No newline at end of file From 6fe12c153dd9dd102428c18a80a294d12558b0c9 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Mon, 3 Nov 2025 14:16:23 +0300 Subject: [PATCH 09/16] fix --- .github/workflows/pr-verify.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index 4d88988b..a16a3cd4 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -33,7 +33,7 @@ jobs: - name: Run formatter - run: dotnet format -v detailed --verify-no-changes + run: dotnet format - name: Commit formatting changes and push uses: stefanzweifel/git-auto-commit-action@v5 From c3fab215880d6f9b50202b9d7598b4c8810ff8c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Nov 2025 11:17:36 +0000 Subject: [PATCH 10/16] chore: Apply automatic dotnet format changes --- src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 355fa892..786b4a10 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -4,9 +4,9 @@ public record WeatherForecast { public DateOnly Date { get; init; } - public int TemperatureC { get; init; } + public int TemperatureC { get; init; } public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; init; } + public string? Summary { get; init; } } From 5561c78b52852df4d4a376c6634268fa84991716 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Mon, 3 Nov 2025 14:57:52 +0300 Subject: [PATCH 11/16] removed ci worflow --- .github/workflows/ci.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index bd0e8e5f..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: CI Workflow - -on: - push: - branches: [ "main" ] - -jobs: - build: - name: CI Workflow - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0 - - - name: Run Tests - run: dotnet test --configuration Release - - - name: Publish Artifact - working-directory: src - run: dotnet publish src/GitHubActionsDotNet.Api/GitHubActionsDotNet.Api.csproj --configuration Release -o artifacts - - - uses: actions/upload-artifact@v4 - with: - name: my-artifact - path: artifacts/ From ef6baf9ed8ab71d57cdf5213b673330ed8f8f298 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Thu, 6 Nov 2025 14:56:54 +0300 Subject: [PATCH 12/16] updated cron yml file --- .github/workflows/cron.yml | 103 +++++++++++++++++++++++++++++--- .github/workflows/pr-verify.yml | 2 +- 2 files changed, 96 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index dda63868..64c9bb91 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -1,14 +1,101 @@ -name: Cron job to run every 5 minutes -# cron jobs like do security scans after a specified period of time +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] schedule: - - cron: '*/5 * * * *' + - cron: '25 2 * * 5' jobs: - cron: - name: Run every 5 minutes - runs-on: ubuntu-latest + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: csharp + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Say Hello World - run: echo "hello world" + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml index a16a3cd4..e826f459 100644 --- a/.github/workflows/pr-verify.yml +++ b/.github/workflows/pr-verify.yml @@ -35,7 +35,7 @@ jobs: - name: Run formatter run: dotnet format - - name: Commit formatting changes and push + - name: Commit formatted changes and push uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "chore: Apply automatic dotnet format changes" From 981b70b411bdd4c82b70412cf2f51d2527b73b00 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Thu, 6 Nov 2025 15:01:14 +0300 Subject: [PATCH 13/16] updated cron job yml file --- .github/workflows/cron.yml | 103 +++---------------------------------- 1 file changed, 8 insertions(+), 95 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 64c9bb91..dda63868 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -1,101 +1,14 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL Advanced" - +name: Cron job to run every 5 minutes +# cron jobs like do security scans after a specified period of time on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] schedule: - - cron: '25 2 * * 5' + - cron: '*/5 * * * *' jobs: - analyze: - name: Analyze (${{ matrix.language }}) - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners (GitHub.com only) - # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - # required for all workflows - security-events: write - - # required to fetch internal or private CodeQL packs - packages: read + cron: + name: Run every 5 minutes + runs-on: ubuntu-latest - # only required for workflows in private repositories - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - include: - - language: actions - build-mode: none - - language: csharp - build-mode: none - # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Add any setup steps before running the `github/codeql-action/init` action. - # This includes steps like installing compilers or runtimes (`actions/setup-node` - # or others). This is typically only required for manual builds. - # - name: Setup runtime (example) - # uses: actions/setup-example@v1 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - name: Run manual build steps - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 - with: - category: "/language:${{matrix.language}}" + - name: Say Hello World + run: echo "hello world" From dfaa5a4af3a9bd33e277b255ed6c07584378aa2c Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Mon, 10 Nov 2025 11:57:51 +0300 Subject: [PATCH 14/16] added a release yml --- .github/workflows/release.yml | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a8656a0a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Create GitHub Release + +on: + push: + tags: + - 'v*' # Runs when a tag starting with 'v' is pushed, e.g., v1.0.0 + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history with tags + + - name: Get previous tag + id: previoustag + run: | + prev_tag=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}"^ 2>/dev/null || true) + echo "previous_tag=$prev_tag" >> $GITHUB_OUTPUT + + - name: Generate Changelog (only between tags) + id: changelog + shell: bash + run: | + prev="${{ steps.previoustag.outputs.previous_tag }}" + tag="${GITHUB_REF_NAME}" + + # Generate changelog safely + if [ -n "$prev" ]; then + changelog=$(git log "${prev}..${tag}" --pretty=format:"- %s (%h)" || true) + else + changelog=$(git log "${tag}" --pretty=format:"- %s (%h)" || true) + fi + + { + echo "changelog<> "$GITHUB_OUTPUT" + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + body: ${{ steps.changelog.outputs.changelog }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7310d29fb6350ababb603d1a18068cd39a89097b Mon Sep 17 00:00:00 2001 From: Nakimuli Susan <99389708+NakimuliSusan@users.noreply.github.com> Date: Thu, 20 Nov 2025 17:54:06 +0300 Subject: [PATCH 15/16] update --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8656a0a..7f2993cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,13 +15,20 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch full history with tags + # Fetch full history with tags, necessary for git log/describe + fetch-depth: 0 - - name: Get previous tag + - name: Get previous tag id: previoustag run: | - prev_tag=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}"^ 2>/dev/null || true) - echo "previous_tag=$prev_tag" >> $GITHUB_OUTPUT + # Finds the latest tag that IS NOT the current tag being pushed. + # The "|| true" ensures the workflow doesn't fail if this is the very first tag. + prev_tag=$(git describe --tags --abbrev=0 --exclude='${{ github.ref_name }}' || true) + # Only output if a previous tag was found + if [ -n "$prev_tag" ]; then + echo "previous_tag=${prev_tag}" >> $GITHUB_OUTPUT + fi + echo "Previous Tag Found: ${prev_tag}" - name: Generate Changelog (only between tags) id: changelog @@ -30,19 +37,28 @@ jobs: prev="${{ steps.previoustag.outputs.previous_tag }}" tag="${GITHUB_REF_NAME}" - # Generate changelog safely + # Determine the commit range for the changelog if [ -n "$prev" ]; then - changelog=$(git log "${prev}..${tag}" --pretty=format:"- %s (%h)" || true) + # Log from the previous tag (exclusive) up to the current tag (inclusive) + log_range="${prev}..${tag}" + changelog_title="## What is in this release ${tag}" else - changelog=$(git log "${tag}" --pretty=format:"- %s (%h)" || true) + # If no previous tag, log all commits up to the current tag + log_range="${tag}" + changelog_title="## Initial Release ${tag}" fi + # Generate changelog with subject and short hash + # Using || true to avoid failure if no commits are found in the range (unlikely with a new tag) + changelog=$(git log "${log_range}" --pretty=format:"- %s (%h)" || true) + + # Use EOD (End Of Delimiter) for multi-line output { - echo "changelog<> "$GITHUB_OUTPUT" - name: Create Release From 118a23fee9c47090e553f80096e67ab9b673f829 Mon Sep 17 00:00:00 2001 From: Nakimuli Susan Date: Thu, 20 Nov 2025 18:02:21 +0300 Subject: [PATCH 16/16] chore:updated --- .editorconfig | 732 ++++++++---------- .github/workflows/release.yml | 36 +- .../Models/WeatherForecastTests.cs | 4 +- .../Controllers/WeatherForecastController.cs | 3 +- .../Models/WeatherForecast.cs | 2 +- src/GitHubActionsDotNet.Api/Program.cs | 2 +- 6 files changed, 353 insertions(+), 426 deletions(-) diff --git a/.editorconfig b/.editorconfig index 944ea2c4..b5f39e6a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,450 +1,364 @@ -# Version: 4.1.1 (Using https://semver.org/) -# Updated: 2022-05-23 -# See https://github.com/RehanSaeed/EditorConfig/releases for release notes. -# See https://github.com/RehanSaeed/EditorConfig for updates to this file. -# See http://EditorConfig.org for more information about .editorconfig files. - -########################################## -# Common Settings -########################################## - -# This file is the top-most EditorConfig file root = true -# All Files +# All files [*] -charset = utf-8 indent_style = space -indent_size = 4 -insert_final_newline = true -trim_trailing_whitespace = true -########################################## -# File Extension Settings -########################################## +# Xml files +[*.xml] +indent_size = 2 -# Visual Studio Solution Files -[*.sln] -indent_style = tab +# C# files +[*.cs] -# Visual Studio XML Project Files -[*.{csproj,vbproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 +#### Core EditorConfig Options #### -# XML Configuration Files -[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}] -indent_size = 2 +# Indentation and spacing +indent_size = 4 +tab_width = 4 -# JSON Files -[*.{json,json5,webmanifest}] -indent_size = 2 +# New line preferences +end_of_line = crlf +insert_final_newline = false -# YAML Files -[*.{yml,yaml}] -indent_size = 2 +#### .NET Coding Conventions #### +[*.{cs,vb}] -# Markdown Files -[*.{md,mdx}] -trim_trailing_whitespace = false +# Organize usings +dotnet_separate_import_directive_groups = true +dotnet_sort_system_directives_first = true +file_header_template = unset -# Web Files -[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}] -indent_size = 2 +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent -# Batch Files -[*.{cmd,bat}] -end_of_line = crlf +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent -# Bash Files -[*.sh] -end_of_line = lf - -# Makefiles -[Makefile] -indent_style = tab - -########################################## -# Default .NET Code Style Severities -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope -########################################## - -[*.{cs,csx,cake,vb,vbx}] -# Default Severity for all .NET Code Style rules below -dotnet_analyzer_diagnostic.severity = warning - -########################################## -# Language Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules -########################################## - -# .NET Style Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules -[*.{cs,csx,cake,vb,vbx}] -# "this." and "Me." qualifiers -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_property = false -dotnet_style_qualification_for_method = false -dotnet_style_qualification_for_event = false -# Language keywords instead of framework type names for type references -dotnet_style_predefined_type_for_locals_parameters_members = true:warning -dotnet_style_predefined_type_for_member_access = true:warning -# Modifier preferences -dotnet_style_require_accessibility_modifiers = always:warning -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning -visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning -dotnet_style_readonly_field = true:warning # Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + # Expression-level preferences -dotnet_style_object_initializer = true:warning -dotnet_style_collection_initializer = true:warning -dotnet_style_explicit_tuple_names = true:warning -dotnet_style_prefer_inferred_tuple_names = true:warning -dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning -dotnet_style_prefer_auto_properties = true:warning -dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion -dotnet_diagnostic.IDE0045.severity = suggestion -dotnet_style_prefer_conditional_expression_over_return = false:suggestion -dotnet_diagnostic.IDE0046.severity = suggestion -dotnet_style_prefer_compound_assignment = true:warning -dotnet_style_prefer_simplified_interpolation = true:warning -dotnet_style_prefer_simplified_boolean_expressions = true:warning -# Null-checking preferences -dotnet_style_coalesce_expression = true:warning -dotnet_style_null_propagation = true:warning -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning -# File header preferences -# file_header_template = \n© PROJECT-AUTHOR\n -# If you use StyleCop, you'll need to disable SA1636: File header copyright text should match. -# dotnet_diagnostic.SA1636.severity = none -# Undocumented -dotnet_style_operator_placement_when_wrapping = end_of_line:warning -csharp_style_prefer_null_check_over_type_check = true:warning - -# C# Style Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules -[*.{cs,csx,cake}] -# 'var' preferences -csharp_style_var_for_built_in_types = true:warning -csharp_style_var_when_type_is_apparent = true:warning -csharp_style_var_elsewhere = true:warning +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:warning + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +#### C# Coding Conventions #### +[*.cs] + +# var preferences +csharp_style_var_elsewhere = false:silent +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent + # Expression-bodied members -csharp_style_expression_bodied_methods = true:warning -csharp_style_expression_bodied_constructors = true:warning -csharp_style_expression_bodied_operators = true:warning -csharp_style_expression_bodied_properties = true:warning -csharp_style_expression_bodied_indexers = true:warning -csharp_style_expression_bodied_accessors = true:warning -csharp_style_expression_bodied_lambdas = true:warning -csharp_style_expression_bodied_local_functions = true:warning +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + # Pattern matching preferences -csharp_style_pattern_matching_over_is_with_cast_check = true:warning -csharp_style_pattern_matching_over_as_with_null_check = true:warning -csharp_style_prefer_switch_expression = true:warning -csharp_style_prefer_pattern_matching = true:warning -csharp_style_prefer_not_pattern = true:warning -# Expression-level preferences -csharp_style_inlined_variable_declaration = true:warning -csharp_prefer_simple_default_expression = true:warning -csharp_style_pattern_local_over_anonymous_function = true:warning -csharp_style_deconstructed_variable_declaration = true:warning -csharp_style_prefer_index_operator = true:warning -csharp_style_prefer_range_operator = true:warning -csharp_style_implicit_object_creation_when_type_is_apparent = true:warning -# "Null" checking preferences -csharp_style_throw_expression = true:warning -csharp_style_conditional_delegate_call = true:warning -# Code block preferences -csharp_prefer_braces = true:warning -csharp_prefer_simple_using_statement = true:suggestion -dotnet_diagnostic.IDE0063.severity = suggestion -# 'using' directive preferences -csharp_using_directive_placement = inside_namespace:warning +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + # Modifier preferences csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent -########################################## -# Unnecessary Code Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/unnecessary-code-rules -########################################## - -# .NET Unnecessary code rules -[*.{cs,csx,cake,vb,vbx}] -dotnet_code_quality_unused_parameters = all:warning -dotnet_remove_unnecessary_suppression_exclusions = none:warning +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion -# C# Unnecessary code rules -[*.{cs,csx,cake}] -csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion -dotnet_diagnostic.IDE0058.severity = suggestion +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion csharp_style_unused_value_assignment_preference = discard_variable:suggestion -dotnet_diagnostic.IDE0059.severity = suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:silent -########################################## -# Formatting Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules -########################################## +#### C# Formatting Rules #### -# .NET formatting rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#net-formatting-rules -[*.{cs,csx,cake,vb,vbx}] -# Organize using directives -dotnet_sort_system_directives_first = true -dotnet_separate_import_directive_groups = false -# Dotnet namespace options -dotnet_style_namespace_match_folder = true:suggestion -dotnet_diagnostic.IDE0130.severity = suggestion - -# C# formatting rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules -[*.{cs,csx,cake}] -# Newline options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true +# New line preferences csharp_new_line_before_catch = true +csharp_new_line_before_else = true csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all csharp_new_line_between_query_expression_clauses = true -# Indentation options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#indentation-options -csharp_indent_case_contents = true -csharp_indent_switch_labels = true -csharp_indent_labels = no_change + +# Indentation preferences csharp_indent_block_contents = true csharp_indent_braces = false -csharp_indent_case_contents_when_block = false -# Spacing options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences csharp_space_after_cast = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_between_parentheses = false -csharp_space_before_colon_in_inheritance_clause = true csharp_space_after_colon_in_inheritance_clause = true -csharp_space_around_binary_operators = before_and_after -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false csharp_space_after_comma = true -csharp_space_before_comma = false csharp_space_after_dot = false -csharp_space_before_dot = false +csharp_space_after_keywords_in_control_flow_statements = true csharp_space_after_semicolon_in_for_statement = true -csharp_space_before_semicolon_in_for_statement = false +csharp_space_around_binary_operators = before_and_after csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false csharp_space_between_square_brackets = false -# Wrap options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options -csharp_preserve_single_line_statements = false + +# Wrapping preferences csharp_preserve_single_line_blocks = true -# Namespace options -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options -csharp_style_namespace_declarations = file_scoped:warning - -########################################## -# .NET Naming Rules -# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules -########################################## - -[*.{cs,csx,cake,vb,vbx}] - -########################################## -# Styles -########################################## - -# camel_case_style - Define the camelCase style -dotnet_naming_style.camel_case_style.capitalization = camel_case -# pascal_case_style - Define the PascalCase style -dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# first_upper_style - The first character must start with an upper-case character -dotnet_naming_style.first_upper_style.capitalization = first_word_upper -# prefix_interface_with_i_style - Interfaces must be PascalCase and the first character of an interface must be an 'I' -dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case -dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I -# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and the first character must be a 'T' -dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case -dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T -# disallowed_style - Anything that has this style applied is marked as disallowed -dotnet_naming_style.disallowed_style.capitalization = pascal_case -dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____ -dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____ -# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file -dotnet_naming_style.internal_error_style.capitalization = pascal_case -dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____ -dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____ - -########################################## -# .NET Design Guideline Field Naming Rules -# Naming rules for fields follow the .NET Framework design guidelines -# https://docs.microsoft.com/dotnet/standard/design-guidelines/index -########################################## - -# All public/protected/protected_internal constant fields must be PascalCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const -dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning - -# All public/protected/protected_internal static readonly fields must be PascalCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly -dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning - -# No other public/protected/protected_internal fields are allowed -# https://docs.microsoft.com/dotnet/standard/design-guidelines/field -dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal -dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style -dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error - -########################################## -# StyleCop Field Naming Rules -# Naming rules for fields follow the StyleCop analyzers -# This does not override any rules using disallowed_style above -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers -########################################## - -# All constant fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const -dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning - -# All static readonly fields must be PascalCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private -dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly -dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = pascal_case_style -dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning - -# No non-private instance fields are allowed -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected -dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style -dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error - -# Private fields must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1306.md -dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private -dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning - -# Local variables must be camelCase -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1312.md -dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local -dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style -dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent - -# This rule should never fire. However, it's included for at least two purposes: -# First, it helps to understand, reason about, and root-case certain types of issues, such as bugs in .editorconfig parsers. -# Second, it helps to raise immediate awareness if a new field type is added (as occurred recently in C#). -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = * -dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style -dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error - - -########################################## -# Other Naming Rules -########################################## - -# All of the following must be PascalCase: -# - Namespaces -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-namespaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Classes and Enumerations -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1300.md -# - Delegates -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types -# - Constructors, Properties, Events, Methods -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members -dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property -dotnet_naming_rule.element_rule.symbols = element_group -dotnet_naming_rule.element_rule.style = pascal_case_style -dotnet_naming_rule.element_rule.severity = warning - -# Interfaces use PascalCase and are prefixed with uppercase 'I' -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_symbols.interface_group.applicable_kinds = interface -dotnet_naming_rule.interface_rule.symbols = interface_group -dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style -dotnet_naming_rule.interface_rule.severity = warning - -# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T' -# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces -dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter -dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group -dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style -dotnet_naming_rule.type_parameter_rule.severity = warning - -# Function parameters use camelCase -# https://docs.microsoft.com/dotnet/standard/design-guidelines/naming-parameters -dotnet_naming_symbols.parameters_group.applicable_kinds = parameter -dotnet_naming_rule.parameters_rule.symbols = parameters_group -dotnet_naming_rule.parameters_rule.style = camel_case_style -dotnet_naming_rule.parameters_rule.severity = warning - -########################################## -# License -########################################## -# The following applies as to the .editorconfig file ONLY, and is -# included below for reference, per the requirements of the license -# corresponding to this .editorconfig file. -# See: https://github.com/RehanSaeed/EditorConfig -# -# MIT License -# -# Copyright (c) 2017-2019 Muhammad Rehan Saeed -# Copyright (c) 2019 Henry Gabryjelski -# -# Permission is hereby granted, free of charge, to any -# person obtaining a copy of this software and associated -# documentation files (the "Software"), to deal in the -# Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, -# sublicense, and/or sell copies of the Software, and to permit -# persons to whom the Software is furnished to do so, subject -# to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -########################################## \ No newline at end of file +csharp_preserve_single_line_statements = true + +#### Naming styles #### +[*.{cs,vb}] + +# Naming rules + +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion +dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces +dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase + +dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion +dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters +dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase + +dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods +dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties +dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.events_should_be_pascalcase.symbols = events +dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables +dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase + +dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants +dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase + +dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion +dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters +dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase + +dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields +dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion +dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields +dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase + +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase + +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums +dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase + +# Symbol specifications + +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interfaces.required_modifiers = + +dotnet_naming_symbols.enums.applicable_kinds = enum +dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enums.required_modifiers = + +dotnet_naming_symbols.events.applicable_kinds = event +dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.events.required_modifiers = + +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.methods.required_modifiers = + +dotnet_naming_symbols.properties.applicable_kinds = property +dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.properties.required_modifiers = + +dotnet_naming_symbols.public_fields.applicable_kinds = field +dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_fields.required_modifiers = + +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_fields.required_modifiers = + +dotnet_naming_symbols.private_static_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_fields.required_modifiers = static + +dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum +dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types_and_namespaces.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +dotnet_naming_symbols.type_parameters.applicable_kinds = namespace +dotnet_naming_symbols.type_parameters.applicable_accessibilities = * +dotnet_naming_symbols.type_parameters.required_modifiers = + +dotnet_naming_symbols.private_constant_fields.applicable_kinds = field +dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_constant_fields.required_modifiers = const + +dotnet_naming_symbols.local_variables.applicable_kinds = local +dotnet_naming_symbols.local_variables.applicable_accessibilities = local +dotnet_naming_symbols.local_variables.required_modifiers = + +dotnet_naming_symbols.local_constants.applicable_kinds = local +dotnet_naming_symbols.local_constants.applicable_accessibilities = local +dotnet_naming_symbols.local_constants.required_modifiers = const + +dotnet_naming_symbols.parameters.applicable_kinds = parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.required_modifiers = + +dotnet_naming_symbols.public_constant_fields.applicable_kinds = field +dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_constant_fields.required_modifiers = const + +dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function +dotnet_naming_symbols.local_functions.applicable_accessibilities = * +dotnet_naming_symbols.local_functions.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascalcase.required_prefix = +dotnet_naming_style.pascalcase.required_suffix = +dotnet_naming_style.pascalcase.word_separator = +dotnet_naming_style.pascalcase.capitalization = pascal_case + +dotnet_naming_style.ipascalcase.required_prefix = I +dotnet_naming_style.ipascalcase.required_suffix = +dotnet_naming_style.ipascalcase.word_separator = +dotnet_naming_style.ipascalcase.capitalization = pascal_case + +dotnet_naming_style.tpascalcase.required_prefix = T +dotnet_naming_style.tpascalcase.required_suffix = +dotnet_naming_style.tpascalcase.word_separator = +dotnet_naming_style.tpascalcase.capitalization = pascal_case + +dotnet_naming_style._camelcase.required_prefix = _ +dotnet_naming_style._camelcase.required_suffix = +dotnet_naming_style._camelcase.word_separator = +dotnet_naming_style._camelcase.capitalization = camel_case + +dotnet_naming_style.camelcase.required_prefix = +dotnet_naming_style.camelcase.required_suffix = +dotnet_naming_style.camelcase.word_separator = +dotnet_naming_style.camelcase.capitalization = camel_case + +dotnet_naming_style.s_camelcase.required_prefix = s_ +dotnet_naming_style.s_camelcase.required_suffix = +dotnet_naming_style.s_camelcase.word_separator = +dotnet_naming_style.s_camelcase.capitalization = camel_case + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8656a0a..845149e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Create GitHub Release on: push: tags: - - 'v*' # Runs when a tag starting with 'v' is pushed, e.g., v1.0.0 + - 'v*' jobs: release: @@ -15,35 +15,47 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch full history with tags + fetch-depth: 0 - name: Get previous tag id: previoustag run: | - prev_tag=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}"^ 2>/dev/null || true) - echo "previous_tag=$prev_tag" >> $GITHUB_OUTPUT + # Find the most recent tag BEFORE the current tag + prev_tag=$(git tag --sort=-creatordate | grep -v "^${{ github.ref_name }}$" | head -n 1) - - name: Generate Changelog (only between tags) + if [ -n "$prev_tag" ]; then + echo "previous_tag=$prev_tag" >> $GITHUB_OUTPUT + echo "Previous tag: $prev_tag" + else + echo "No previous tag found" + fi + + - name: Generate changelog id: changelog shell: bash run: | prev="${{ steps.previoustag.outputs.previous_tag }}" tag="${GITHUB_REF_NAME}" - # Generate changelog safely + # Choose commit range if [ -n "$prev" ]; then - changelog=$(git log "${prev}..${tag}" --pretty=format:"- %s (%h)" || true) + log_range="${prev}..${tag}" + changelog_title="## Changes in ${tag}" else - changelog=$(git log "${tag}" --pretty=format:"- %s (%h)" || true) + log_range="${tag}" + changelog_title="## Initial Release ${tag}" fi + # Generate logs between tags + changelog=$(git log ${log_range} --pretty=format:"- %s (%h)" || true) + { - echo "changelog<> "$GITHUB_OUTPUT" + echo "EOD" + } >> $GITHUB_OUTPUT - name: Create Release uses: softprops/action-gh-release@v1 diff --git a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs index 420d0370..5f01079b 100644 --- a/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs +++ b/src/GitHubActionsDotNet.Api.Tests/Models/WeatherForecastTests.cs @@ -1,5 +1,6 @@ namespace GitHubActionsDotNet.Api.Tests; using FluentAssertions; + using GitHubActionsDotNet.Api.Models; public class WeatherForecastTests @@ -15,5 +16,4 @@ public void TemperatureFShouldReturnCorrectValueBasedOnTemperatureC() weatherForecast.TemperatureF.Should().Be(32); } -} - +} \ No newline at end of file diff --git a/src/GitHubActionsDotNet.Api/Controllers/WeatherForecastController.cs b/src/GitHubActionsDotNet.Api/Controllers/WeatherForecastController.cs index d91d7957..3b562829 100644 --- a/src/GitHubActionsDotNet.Api/Controllers/WeatherForecastController.cs +++ b/src/GitHubActionsDotNet.Api/Controllers/WeatherForecastController.cs @@ -1,5 +1,6 @@ namespace GitHubActionsDotNet.Api.Controllers; using GitHubActionsDotNet.Api.Models; + using Microsoft.AspNetCore.Mvc; [ApiController] @@ -28,4 +29,4 @@ public class WeatherForecastController : ControllerBase Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) .ToArray(); -} +} \ No newline at end of file diff --git a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs index 786b4a10..88d9fbb3 100644 --- a/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs +++ b/src/GitHubActionsDotNet.Api/Models/WeatherForecast.cs @@ -9,4 +9,4 @@ public record WeatherForecast public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); public string? Summary { get; init; } -} +} \ No newline at end of file diff --git a/src/GitHubActionsDotNet.Api/Program.cs b/src/GitHubActionsDotNet.Api/Program.cs index 303f498f..834598e1 100644 --- a/src/GitHubActionsDotNet.Api/Program.cs +++ b/src/GitHubActionsDotNet.Api/Program.cs @@ -23,4 +23,4 @@ app.MapControllers(); -app.Run(); +app.Run(); \ No newline at end of file