From c347098c4eee1740dfc7c30794285696446c6141 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:29:20 +0100 Subject: [PATCH 01/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20integrate=20?= =?UTF-8?q?OpenAI=20API=20for=20automated=20release=20descriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a PowerShell script to generate release descriptions using OpenAI's API. This script fetches commit logs or diffs, formats them, and sends them to the API for generating structured release notes. The generated description is then included in the GitHub Actions workflow for releases. Automating the generation of release descriptions ensures consistency and saves time, while leveraging AI helps in creating comprehensive and well-structured release notes. --- .github/workflows/main.yml | 5 + build/include/Get-ReleaseDescription.ps1 | 203 +++++++++++++++++++++++ 2 files changed, 208 insertions(+) create mode 100644 build/include/Get-ReleaseDescription.ps1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b49026f4a..64a2122f6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -279,6 +279,9 @@ jobs: if ($Env:nkdAgility_Ring -eq 'Release') { echo "discussion_category_name=Anouncement" >> $env:GITHUB_OUTPUT } + . ./build/include/Get-ReleaseDescription.ps1 + $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} + echo "release_description=$description" >> $env:GITHUB_OUTPUT - name: Release uses: softprops/action-gh-release@v2 @@ -299,6 +302,8 @@ jobs: Version: ${{ needs.Setup.outputs.GitVersion_SemVer }} Ring: (${{ needs.Setup.outputs.nkdAgility_Ring }}) + ${{ steps.release-options.outputs.release_description }} + ## Get the tools - Download the [MigrationTools-${{ needs.Setup.outputs.GitVersion_SemVer }}.zip](https://github.com/nkdAgility/azure-devops-migration-tools/releases/download/v${{ needs.Setup.outputs.GitVersion_SemVer }}/MigrationTools-${{ needs.Setup.outputs.GitVersion_SemVer }}.zip) file below diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 new file mode 100644 index 000000000..9d69bd94d --- /dev/null +++ b/build/include/Get-ReleaseDescription.ps1 @@ -0,0 +1,203 @@ +<# + Script description. + + Some notes. +#> +# Helpers +enum ExecutionMode { + log = 0 + diff = 1 +} + +# Define Parameters +function Get-ReleaseDescription { + param ( + + [Parameter(Mandatory=$false)] + [string]$compairFrom, + + # name of the output folder + [Parameter(Mandatory=$false)] + [string]$compairTo, + + # name of the output folder + [Parameter(Mandatory=$true)] + [ExecutionMode]$mode, + + # name of the output folder + [Parameter(Mandatory=$true)] + [string]$OPEN_AI_KEY + ) + Write-Output "Azure DevOps Migration Tools (Release) Description" + Write-Output "=========================================" + Write-Output "Mode: $mode" + if ([string]::IsNullOrEmpty($compairFrom) ){ + $lastRelease = gh release list --exclude-pre-releases --json name,tagName,publishedAt --limit 1 | ConvertFrom-Json + $compairFrom = $lastRelease.tagName + } + If ([string]::IsNullOrEmpty($compairTo) ) { + $compairTo = "main" + } + Write-Output "Comparing: $compairFrom...$compairTo" + Write-Output "-----------------------------------------" + + switch ($mode) + { + "log" { + $result = git log --pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' "$compairFrom...$compairTo" + } + "diff" { + $diffOutPut = git diff "$compairFrom...$compairTo" + $joineddiffOutPut = $diffOutPut -join "`n" + $splitdiffOutPut = $joineddiffOutPut -split "diff --git" + $result = $splitdiffOutPut | ConvertTo-Json + } + default { + Write-Output "Invalid mode" + return + } + } + + If ([string]::IsNullOrEmpty($result) ) { + Write-Output "No changes found" + return + } + + $prompt = @" + + Your mission is to create clean and comprehensive overview of the changes as per the GitMoji specification conventional commit convention and explain: + + - **WHAT** were the changes + - **WHY** the changes were done + + I'll send you an output of the `git diff` command, and you are to convert it into a list of commits .For each commit Use GitMoji convention to preface each commit. Here are some help to choose the right emoji (emoji, description): + + - πŸ›, Fix a bug + - ✨, Introduce new features + - πŸ“, Add or update documentation + - πŸš€, Deploy stuff + - βœ…, Add, update, or pass tests + - ♻️, Refactor code + - ⬆️, Upgrade dependencies + - πŸ”§, Add or update configuration files + - 🌐, Internationalization and localization + - πŸ’‘, Add or update comments in source code + - 🎨, Improve structure/format of the code + - ⚑️, Improve performance + - πŸ”₯, Remove code or files + - πŸš‘οΈ, Critical hotfix + - πŸ’„, Add or update the UI and style files + - πŸŽ‰, Begin a project + - πŸ”’οΈ, Fix security issues + - πŸ”, Add or update secrets + - πŸ”–, Release / Version tags + - 🚨, Fix compiler / linter warnings + - 🚧, Work in progress + - πŸ’š, Fix CI Build + - ⬇️, Downgrade dependencies + - πŸ“Œ, Pin dependencies to specific versions + - πŸ‘·, Add or update CI build system + - πŸ“ˆ, Add or update analytics or track code + - βž•, Add a dependency + - βž–, Remove a dependency + - πŸ”¨, Add or update development scripts + - ✏️, Fix typos + - πŸ’©, Write bad code that needs to be improved + - βͺ️, Revert changes + - πŸ”€, Merge branches + - πŸ“¦οΈ, Add or update compiled files or packages + - πŸ‘½οΈ, Update code due to external API changes + - 🚚, Move or rename resources (e.g., files, paths, routes) + - πŸ“„, Add or update license + - πŸ’₯, Introduce breaking changes + - 🍱, Add or update assets + - ♿️, Improve accessibility + - 🍻, Write code drunkenly + - πŸ’¬, Add or update text and literals + - πŸ—ƒοΈ, Perform database related changes + - πŸ”Š, Add or update logs + - πŸ”‡, Remove logs + - πŸ‘₯, Add or update contributor(s) + - 🚸, Improve user experience / usability + - πŸ—οΈ, Make architectural changes + - πŸ“±, Work on responsive design + - 🀑, Mock things + - πŸ₯š, Add or update an easter egg + - πŸ™ˆ, Add or update a .gitignore file + - πŸ“Έ, Add or update snapshots + - βš—οΈ, Perform experiments + - πŸ”οΈ, Improve SEO + - 🏷️, Add or update types + - 🌱, Add or update seed files + - 🚩, Add, update, or remove feature flags + - πŸ₯…, Catch errors + - πŸ’«, Add or update animations and transitions + - πŸ—‘οΈ, Deprecate code that needs to be cleaned up + - πŸ›‚, Work on code related to authorization, roles and permissions + - 🩹, Simple fix for a non-critical issue + - 🧐, Data exploration/inspection + - ⚰️, Remove dead code + - πŸ§ͺ, Add a failing test + - πŸ‘”, Add or update business logic + - 🩺, Add or update healthcheck + - 🧱, Infrastructure related changes + - πŸ§‘β€πŸ’», Improve developer experience + - πŸ’Έ, Add sponsorships or money related infrastructure + - 🧡, Add or update code related to multithreading or concurrency + - 🦺, Add or update code related to validation + + Conventional commit keywords: fix, feat, build, chore, ci, docs, style, refactor, perf, test. + + - On the same line include a short description of **WHY** the changes are done after the commit message. + - Don't start it with "This commit", just describe the changes. + - Don't add any descriptions to the commit, only commit message. + + + At the beginning of the list of changes, add an overview of the changes in the following format: + + - Look at the overall archtecture and changes and describe the value of this release in a single paragraph. + - Do not add a title. + + Aditional information: + + - Use the present tense. + - Lines must not be longer than 74 characters. + - Use en-gb for the commit message. +"@ + + # Set the API endpoint and API key + $apiUrl = "https://api.openai.com/v1/chat/completions" + + # Convert $resultItems to a single string + #$resultItemsString = $resultItems -join "`n" + + # Prepare the full prompt with the git diff results appended + $fullPrompt = $prompt + "`n`nUse the folowing json:`n`n" + $result + + # Create the body for the API request + $body = @{ + "model" = "gpt-4-turbo" + "messages" = @( + @{ + "role" = "system" + "content" = "You are an expert assistant that generates high-quality, structured content based on Git diffs using the GitMoji specification. You follow UK English conventions and keep lines under 74 characters." + }, + @{ + "role" = "user" + "content" = $fullPrompt + } + ) + "temperature" = 0 + "max_tokens" = 2048 + } | ConvertTo-Json + + # Send the request to the ChatGPT API + $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers @{ + "Content-Type" = "application/json" + "Authorization" = "Bearer $OPEN_AI_KEY" + } -Body $body + + # Extract and display the response content + $result = $response.choices[0].message.content + return $result +} \ No newline at end of file From d06b4a146b345cf32d460ce6aee8f42102ab9211 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:31:02 +0100 Subject: [PATCH 02/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20wor?= =?UTF-8?q?kflow=20condition=20to=20always=20run=20steps=20regardless=20of?= =?UTF-8?q?=20nkdAgility=5FRing=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The condition for running the steps is simplified to always run if the previous steps are successful. The previous condition checking for `nkdAgility_Ring != 'Canary'` is commented out, likely to ensure the steps run in all environments for broader testing or deployment purposes. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64a2122f6..96ecac2ab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -258,7 +258,7 @@ jobs: HasChanged_docs: ${{ needs.Setup.outputs.HasChanged_docs }} HasChanged_automation: ${{ needs.Setup.outputs.HasChanged_automation }} needs: [build, Setup] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} + if: ${{ success() }} #&& ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) steps: - uses: actions/download-artifact@v4 with: From 9c63a06a680aca6d8a68e958450e8b0fc5371b2a Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:40:38 +0100 Subject: [PATCH 03/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20fix=20path?= =?UTF-8?q?=20separator=20for=20PowerShell=20script=20in=20GitHub=20Action?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The path separator is corrected from Unix-style (`./`) to Windows-style (`.\`) to ensure compatibility with PowerShell on Windows runners. This change is necessary to avoid script execution errors in the GitHub Actions workflow. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 96ecac2ab..5ad9056ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -279,7 +279,7 @@ jobs: if ($Env:nkdAgility_Ring -eq 'Release') { echo "discussion_category_name=Anouncement" >> $env:GITHUB_OUTPUT } - . ./build/include/Get-ReleaseDescription.ps1 + . .\build\include\Get-ReleaseDescription.ps1 $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} echo "release_description=$description" >> $env:GITHUB_OUTPUT From 881d4c26149adecac1c06a45dc93ed0701ba54d2 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:45:12 +0100 Subject: [PATCH 04/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20upload?= =?UTF-8?q?=20and=20download=20steps=20for=20AzureDevOpsMigrationTools-Scr?= =?UTF-8?q?ipts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include steps to upload and download the AzureDevOpsMigrationTools-Scripts artifact in the GitHub Actions workflow. This ensures that the scripts are properly archived and available for subsequent jobs, improving the workflow's robustness and reliability. --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ad9056ec..6e0cdcb9a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -215,6 +215,10 @@ jobs: with: name: AzureDevOpsMigrationTools-Packages path: ./staging/** + - uses: actions/upload-artifact@v4 + with: + name: AzureDevOpsMigrationTools-Scripts + path: ./build/** # Build Docs BuildDocs: @@ -263,6 +267,9 @@ jobs: - uses: actions/download-artifact@v4 with: name: AzureDevOpsMigrationTools-Packages + - uses: actions/download-artifact@v4 + with: + name: AzureDevOpsMigrationTools-Scripts - uses: actions/create-github-app-token@v1 id: app-token with: From f47cce13c423b2dfc2ea3ee115528126c18f6bec Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:46:25 +0100 Subject: [PATCH 05/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20specify=20pa?= =?UTF-8?q?th=20for=20downloaded=20artifact=20in=20GitHub=20Actions=20work?= =?UTF-8?q?flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding the `path: ./build/` parameter to the `actions/download-artifact@v4` step ensures that the downloaded artifact is placed in the `./build/` directory. This change improves the organization of the workflow by clearly defining where artifacts should be stored, making it easier to manage and locate them during subsequent steps. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e0cdcb9a..a4a8694da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -270,6 +270,7 @@ jobs: - uses: actions/download-artifact@v4 with: name: AzureDevOpsMigrationTools-Scripts + path: ./build/ - uses: actions/create-github-app-token@v1 id: app-token with: From f6f59ea9b740c8a49f1dfaa75eb418fd86531b39 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 10:59:13 +0100 Subject: [PATCH 06/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20releas?= =?UTF-8?q?e=20description=20output=20and=20adjust=20artifact=20upload=20s?= =?UTF-8?q?teps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add `nkdAgility_ReleaseDescription` to capture release descriptions using the OpenAI API. Adjust artifact upload steps to ensure scripts are uploaded only once, improving workflow efficiency. This change enhances the release process by including detailed descriptions and optimizes the workflow by removing redundant steps. --- .github/workflows/main.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a4a8694da..268fecc81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,6 +41,7 @@ jobs: nkdAgility_Ring: ${{ steps.nkdagility.outputs.Ring }} nkdAgility_WingetApplicationId: ${{ steps.nkdagility.outputs.WingetApplicationId }} nkdAgility_IsBuildEditBranch: ${{ steps.nkdagility.outputs.IsBuildEditBranch }} + nkdAgility_ReleaseDescription: ${{ steps.nkdagility.outputs.release_description }} steps: - name: Checkout uses: actions/checkout@v2 @@ -97,7 +98,16 @@ jobs: $IsBuildEditBranch = $true; } Write-Output "IsBuildEditBranch=$IsBuildEditBranch" - echo "IsBuildEditBranch=$IsBuildEditBranch" >> $env:GITHUB_OUTPUT + echo "IsBuildEditBranch=$IsBuildEditBranch" >> $env:GITHUB_OUTPUT + + . .\build\include\Get-ReleaseDescription.ps1 + $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} + echo "release_description=$description" >> $env:GITHUB_OUTPUT + + - uses: actions/upload-artifact@v4 + with: + name: AzureDevOpsMigrationTools-Scripts + path: ./build/** # Setup Validator SetupSummeryStage: @@ -161,10 +171,6 @@ jobs: files: '["**/StaticVariables.cs"]' tokenPrefix: "${" tokenSuffix: "}" - - uses: actions/upload-artifact@v4 - with: - name: AzureDevOpsMigrationTools-BuildScripts - path: ./build/** - name: Setup .NET uses: actions/setup-dotnet@v1 with: @@ -215,10 +221,6 @@ jobs: with: name: AzureDevOpsMigrationTools-Packages path: ./staging/** - - uses: actions/upload-artifact@v4 - with: - name: AzureDevOpsMigrationTools-Scripts - path: ./build/** # Build Docs BuildDocs: @@ -310,7 +312,7 @@ jobs: Version: ${{ needs.Setup.outputs.GitVersion_SemVer }} Ring: (${{ needs.Setup.outputs.nkdAgility_Ring }}) - ${{ steps.release-options.outputs.release_description }} + ${{ needs.Setup.outputs.nkdAgility_ReleaseDescription }} ## Get the tools From 74c94627dbb5809a0d20400f381366814c6965b7 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 11:00:11 +0100 Subject: [PATCH 07/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20nkdAgi?= =?UTF-8?q?lity=5FReleaseDescription=20to=20workflow=20environment=20varia?= =?UTF-8?q?bles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include nkdAgility_ReleaseDescription in the workflow to pass the release description output from the Setup job. This ensures that the release description is available for subsequent steps, improving the workflow's ability to handle release metadata. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 268fecc81..c22d2de76 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,6 +126,7 @@ jobs: - nkdAgility_Ring: ${{needs.Setup.outputs.nkdAgility_Ring}} - nkdAgility_IsBuildEditBranch: ${{needs.Setup.outputs.nkdAgility_IsBuildEditBranch}} - nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}} + - nkdAgility_ReleaseDescription: ${{needs.Setup.outputs.nkdAgility_ReleaseDescription}} ### GitVersion - GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}} - GitVersion_SemVer: ${{needs.Setup.outputs.GitVersion_SemVer}} From e9b853c1a012adf5904d6f05a9400c68b07a0544 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 11:04:39 +0100 Subject: [PATCH 08/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20debug?= =?UTF-8?q?=20output=20for=20running=20Get-ReleaseDescription.ps1=20?= =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(Get-ReleaseDescription.ps1):=20replace=20?= =?UTF-8?q?Write-Output=20with=20Write-Host=20for=20better=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding a debug output line before running `Get-ReleaseDescription.ps1` in the GitHub Actions workflow helps in tracking the script execution. Replacing `Write-Output` with `Write-Host` in the PowerShell script improves readability and ensures that messages are displayed in the console, which is more appropriate for status and informational messages. --- .github/workflows/main.yml | 7 ++++--- build/include/Get-ReleaseDescription.ps1 | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c22d2de76..1a0cdfef8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -100,9 +100,10 @@ jobs: Write-Output "IsBuildEditBranch=$IsBuildEditBranch" echo "IsBuildEditBranch=$IsBuildEditBranch" >> $env:GITHUB_OUTPUT - . .\build\include\Get-ReleaseDescription.ps1 - $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} - echo "release_description=$description" >> $env:GITHUB_OUTPUT + Write-Output "Running Get-ReleaseDescription.ps1" + . .\build\include\Get-ReleaseDescription.ps1 + $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} + echo "release_description=$description" >> $env:GITHUB_OUTPUT - uses: actions/upload-artifact@v4 with: diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 9d69bd94d..698c72fcb 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -28,9 +28,9 @@ function Get-ReleaseDescription { [Parameter(Mandatory=$true)] [string]$OPEN_AI_KEY ) - Write-Output "Azure DevOps Migration Tools (Release) Description" - Write-Output "=========================================" - Write-Output "Mode: $mode" + Write-Host "Azure DevOps Migration Tools (Release) Description" + Write-Host "=========================================" + Write-Host "Mode: $mode" if ([string]::IsNullOrEmpty($compairFrom) ){ $lastRelease = gh release list --exclude-pre-releases --json name,tagName,publishedAt --limit 1 | ConvertFrom-Json $compairFrom = $lastRelease.tagName @@ -38,8 +38,8 @@ function Get-ReleaseDescription { If ([string]::IsNullOrEmpty($compairTo) ) { $compairTo = "main" } - Write-Output "Comparing: $compairFrom...$compairTo" - Write-Output "-----------------------------------------" + Write-Host "Comparing: $compairFrom...$compairTo" + Write-Host "-----------------------------------------" switch ($mode) { @@ -53,13 +53,13 @@ function Get-ReleaseDescription { $result = $splitdiffOutPut | ConvertTo-Json } default { - Write-Output "Invalid mode" + Write-Host "Invalid mode" return } } If ([string]::IsNullOrEmpty($result) ) { - Write-Output "No changes found" + Write-Host "No changes found" return } From de74f6b9efb61553043c2fd168d4b424cb6324b5 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 11:34:14 +0100 Subject: [PATCH 09/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20GitHub?= =?UTF-8?q?=20App=20token=20creation=20step=20to=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include a step to generate a GitHub App token using the `actions/create-github-app-token@v1` action. This token is then used as an environment variable in subsequent steps. This change is necessary to authenticate actions that require GitHub App permissions, enhancing the security and flexibility of the workflow. --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a0cdfef8..e7be8b225 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,6 +57,11 @@ jobs: uses: gittools/actions/gitversion/execute@v1.1.1 with: useConfigFile: true + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }} + private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} - uses: dorny/paths-filter@v3 id: filter with: @@ -71,6 +76,8 @@ jobs: - name: "Build NKDAgility Outputs" shell: pwsh id: nkdagility + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | $Ring = "Canary" $WingetApplicationId = "nkdagility.azure-devops-migration-tools" From c4fb8bac990bc0fb0ae3bfa9da94be061d817e29 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Wed, 7 Aug 2024 11:38:17 +0100 Subject: [PATCH 10/23] =?UTF-8?q?=F0=9F=92=A1=20(Get-ReleaseDescription.ps?= =?UTF-8?q?1):=20add=20log=20messages=20to=20indicate=20running=20git=20co?= =?UTF-8?q?mmands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding log messages before running `git log` and `git diff` commands provides better visibility into the script's execution flow. This helps in debugging and understanding which part of the script is currently being executed. --- build/include/Get-ReleaseDescription.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 698c72fcb..3798771df 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -39,14 +39,15 @@ function Get-ReleaseDescription { $compairTo = "main" } Write-Host "Comparing: $compairFrom...$compairTo" - Write-Host "-----------------------------------------" - + Write-Host "-----------------------------------------" switch ($mode) { "log" { + Write-Host "Running: git log" $result = git log --pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' "$compairFrom...$compairTo" } "diff" { + Write-Host "Running: git diff" $diffOutPut = git diff "$compairFrom...$compairTo" $joineddiffOutPut = $diffOutPut -join "`n" $splitdiffOutPut = $joineddiffOutPut -split "diff --git" @@ -57,7 +58,7 @@ function Get-ReleaseDescription { return } } - + Write-Host "-----------------------------------------" If ([string]::IsNullOrEmpty($result) ) { Write-Host "No changes found" return From 741258dd255deb1a14b19fb7e13cf2672da38825 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 13:22:13 +0100 Subject: [PATCH 11/23] =?UTF-8?q?=F0=9F=92=A1=20(Get-ReleaseDescription.ps?= =?UTF-8?q?1):=20add=20logging=20to=20indicate=20the=20start=20and=20compl?= =?UTF-8?q?etion=20of=20git=20commands=20=E2=99=BB=EF=B8=8F=20(Get-Release?= =?UTF-8?q?Description.ps1):=20comment=20out=20the=20pretty=20format=20opt?= =?UTF-8?q?ion=20in=20git=20log=20command=20for=20better=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding logging statements helps in tracking the execution flow and identifying where the script is during its run. Commenting out the pretty format option in the git log command makes the output more readable and easier to debug. --- build/include/Get-ReleaseDescription.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 3798771df..9807a85fc 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -28,6 +28,7 @@ function Get-ReleaseDescription { [Parameter(Mandatory=$true)] [string]$OPEN_AI_KEY ) + Write-Host "=========================================" Write-Host "Azure DevOps Migration Tools (Release) Description" Write-Host "=========================================" Write-Host "Mode: $mode" @@ -44,7 +45,8 @@ function Get-ReleaseDescription { { "log" { Write-Host "Running: git log" - $result = git log --pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' "$compairFrom...$compairTo" + $result = git log "$compairFrom...$compairTo" #--pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' + Write-Host "Complete: git log" } "diff" { Write-Host "Running: git diff" @@ -52,6 +54,7 @@ function Get-ReleaseDescription { $joineddiffOutPut = $diffOutPut -join "`n" $splitdiffOutPut = $joineddiffOutPut -split "diff --git" $result = $splitdiffOutPut | ConvertTo-Json + Write-Host "Complete: git diff" } default { Write-Host "Invalid mode" From c209050d935c75a1656dab05a13bc101a60d7036 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 13:46:59 +0100 Subject: [PATCH 12/23] =?UTF-8?q?=F0=9F=92=A1=20(Get-ReleaseDescription.ps?= =?UTF-8?q?1):=20add=20additional=20logging=20for=20better=20traceability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add more detailed logging to the Get-ReleaseDescription function to improve traceability and debugging. This includes messages indicating when changes are found, the full prompt being used, the body of the API request, and the steps of sending the request and extracting the output. This helps in understanding the flow and identifying issues more easily. --- build/include/Get-ReleaseDescription.ps1 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 9807a85fc..7c5571332 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -65,6 +65,8 @@ function Get-ReleaseDescription { If ([string]::IsNullOrEmpty($result) ) { Write-Host "No changes found" return + } else { + Write-Host "Changes found to create comment with!" } $prompt = @" @@ -178,7 +180,13 @@ function Get-ReleaseDescription { # Prepare the full prompt with the git diff results appended $fullPrompt = $prompt + "`n`nUse the folowing json:`n`n" + $result + Write-Host "-----------------------------------------" + Write-Host "Prompt:" + Write-Host $fullPrompt + + Write-Host "-----------------------------------------" # Create the body for the API request + Write-Host "Create the body for the API request..." $body = @{ "model" = "gpt-4-turbo" "messages" = @( @@ -194,13 +202,20 @@ function Get-ReleaseDescription { "temperature" = 0 "max_tokens" = 2048 } | ConvertTo-Json - + Write-Host "Body:" + Write-Host $body + + + Write-Host "-----------------------------------------" + Write-Host "Sending request to the ChatGPT API..." # Send the request to the ChatGPT API $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers @{ "Content-Type" = "application/json" "Authorization" = "Bearer $OPEN_AI_KEY" } -Body $body + Write-Host "-----------------------------------------" + Write-Host "Extracting Output.." # Extract and display the response content $result = $response.choices[0].message.content return $result From 3d959bf415a4a433130708536d1aea14ae50ae77 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 13:50:19 +0100 Subject: [PATCH 13/23] =?UTF-8?q?=F0=9F=92=A1=20(Get-ReleaseDescription.ps?= =?UTF-8?q?1):=20improve=20logging=20for=20better=20readability=20and=20de?= =?UTF-8?q?bugging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhance the logging output to make it easier to read and debug. This includes aligning the indentation, adding separators, and providing more context around the extracted result. --- build/include/Get-ReleaseDescription.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 7c5571332..9c2469e3e 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -202,7 +202,7 @@ function Get-ReleaseDescription { "temperature" = 0 "max_tokens" = 2048 } | ConvertTo-Json - Write-Host "Body:" + Write-Host "Body:" Write-Host $body @@ -214,9 +214,15 @@ function Get-ReleaseDescription { "Authorization" = "Bearer $OPEN_AI_KEY" } -Body $body - Write-Host "-----------------------------------------" - Write-Host "Extracting Output.." + Write-Host "-----------------------------------------" + Write-Host "Extracting Output.." # Extract and display the response content $result = $response.choices[0].message.content + Write-Host "-----------------------------------------" + Write-Host "result:" + Write-Host $result + Write-Host "-----------------------------------------" + Write-Host "-----------------------------------------" + Write-Host "Returning.." return $result } \ No newline at end of file From f969c0380e9b1172a62ee9f76c6c9580869a6282 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 13:57:01 +0100 Subject: [PATCH 14/23] Adding multi line support --- .github/workflows/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e0ca19b4..f9274c5c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,7 +110,12 @@ jobs: Write-Output "Running Get-ReleaseDescription.ps1" . .\build\include\Get-ReleaseDescription.ps1 $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} - echo "release_description=$description" >> $env:GITHUB_OUTPUT + + $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) + echo "release_description<<$EOF" >> "${GITHUB_OUTPUT}" + echo $description >> "${GITHUB_OUTPUT}" + echo "$EOF" >> "${GITHUB_OUTPUT}" + #echo "release_description=$description" >> $env:GITHUB_OUTPUT - uses: actions/upload-artifact@v4 with: From d7d3f0472239ff86193895a47b77cc71645ab80e Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:08:25 +0100 Subject: [PATCH 15/23] Update with new prompt --- build/include/Get-ReleaseDescription.ps1 | 31 ++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index 9c2469e3e..defa35e0e 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -45,7 +45,7 @@ function Get-ReleaseDescription { { "log" { Write-Host "Running: git log" - $result = git log "$compairFrom...$compairTo" #--pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' + $result = git log --pretty=format:'{\"hash\": \"%H\", \"author\": \"%an\", \"date\": \"%ad\", \"message\": \"%s\"}' "$compairFrom...$compairTo" # Write-Host "Complete: git log" } "diff" { @@ -170,6 +170,33 @@ function Get-ReleaseDescription { - Lines must not be longer than 74 characters. - Use en-gb for the commit message. "@ + +$prompt2 = @" + You are an expert in software development and business communication. You are given the JSON output of a git log or git diff command, capturing changes made between the last software release and the current one. Your task is to create a clear, detailed, and business-friendly summary of these changes. + +Instructions: + +1. Group by Intent: Organize the changes into categories based on the intent of the changes. Possible categories include (title, emoji, description): + - New Features, ✨, Describe any new functionalities added. + - Enhancements, πŸ’‘,Outline improvements to existing features. + - Bug Fixes, πŸ›,Summarize issues resolved. + - Performance Improvements, ⚑️,Note optimizations made for better performance. + - Refactoring, ♻️,Explain changes aimed at code structure improvement without altering functionality. + - Security Updates, πŸ”’οΈ,Highlight security-related changes. + - Documentation Updates, πŸ“, Mention improvements or additions to documentation. + - Dependency Updates, πŸ“Œ,Specify updates to libraries, packages, or tools. + - Other, 🧱,Capture any other changes that don’t fit the above categories. +2. Link to Pull Requests: Where applicable, reference the relevant Pull Requests (PRs) by number or link, providing context on the reason for the changes. +3. Provide Context: For each category, offer a brief explanation of why these changes were necessary or beneficial from a business perspective. +4. Output Structure: + - Overview: Begin with a high-level summary of the release. + - Detailed Changes: Break down the changes by the categories above, including a description and the impact of each change. + - Conclusion: Finish with a conclusion that provides a brief outlook on the impact these changes are expected to have on the overall project or business goals. +5. Tone: The summary should be written in a professional tone that is accessible to non-technical stakeholders but detailed enough for technical team members. +6. Aditional information: + - Use the present tense. + - Use en-gb for the commit message. +"@ # Set the API endpoint and API key $apiUrl = "https://api.openai.com/v1/chat/completions" @@ -178,7 +205,7 @@ function Get-ReleaseDescription { #$resultItemsString = $resultItems -join "`n" # Prepare the full prompt with the git diff results appended - $fullPrompt = $prompt + "`n`nUse the folowing json:`n`n" + $result + $fullPrompt = $prompt2 + "`n`nUse the folowing json:`n`n" + $result Write-Host "-----------------------------------------" Write-Host "Prompt:" From 609f64051dffd4e62b7d1a3c94b13b3643390a3a Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:18:01 +0100 Subject: [PATCH 16/23] update --- .github/workflows/main.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9274c5c2..d5393eb13 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,11 +110,13 @@ jobs: Write-Output "Running Get-ReleaseDescription.ps1" . .\build\include\Get-ReleaseDescription.ps1 $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} - + if ($description -eq $null) { + $description = "No release description found"; + } $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) - echo "release_description<<$EOF" >> "${GITHUB_OUTPUT}" - echo $description >> "${GITHUB_OUTPUT}" - echo "$EOF" >> "${GITHUB_OUTPUT}" + "release_description<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append + $description | Out-File -FilePath $env:GITHUB_ENV -Append + "$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append #echo "release_description=$description" >> $env:GITHUB_OUTPUT - uses: actions/upload-artifact@v4 From a9e216e41b51e47100d4f8ae73d6d7f72f48f99e Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:25:47 +0100 Subject: [PATCH 17/23] update --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5393eb13..935e67b80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -112,6 +112,8 @@ jobs: $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} if ($description -eq $null) { $description = "No release description found"; + } else { + Write-Output "Release Description: $description" } $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) "release_description<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append From 9cf5a01aee685e049d39691cdc9cd71edc3a7836 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:27:58 +0100 Subject: [PATCH 18/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20add=20releas?= =?UTF-8?q?e=20description=20state=20to=20GitHub=20Actions=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include a new environment variable `nkdAgility_ReleaseDescriptionState` to track the state of the release description. This change helps in determining whether a release description was successfully retrieved or not, improving the robustness and transparency of the CI/CD pipeline. --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 935e67b80..f2213b70c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,6 +42,7 @@ jobs: nkdAgility_WingetApplicationId: ${{ steps.nkdagility.outputs.WingetApplicationId }} nkdAgility_IsBuildEditBranch: ${{ steps.nkdagility.outputs.IsBuildEditBranch }} nkdAgility_ReleaseDescription: ${{ steps.nkdagility.outputs.release_description }} + nkdAgility_ReleaseDescriptionState: ${{ steps.nkdagility.outputs.release_description_state }} steps: - name: Checkout uses: actions/checkout@v2 @@ -112,14 +113,16 @@ jobs: $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} if ($description -eq $null) { $description = "No release description found"; + echo "release_description_state=false" >> $env:GITHUB_OUTPUT } else { + echo "release_description_state=true" >> $env:GITHUB_OUTPUT Write-Output "Release Description: $description" } $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) "release_description<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append $description | Out-File -FilePath $env:GITHUB_ENV -Append "$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append - #echo "release_description=$description" >> $env:GITHUB_OUTPUT + - uses: actions/upload-artifact@v4 with: @@ -143,6 +146,7 @@ jobs: - nkdAgility_Ring: ${{needs.Setup.outputs.nkdAgility_Ring}} - nkdAgility_IsBuildEditBranch: ${{needs.Setup.outputs.nkdAgility_IsBuildEditBranch}} - nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}} + - nkdAgility_ReleaseDescriptionState: ${{needs.Setup.outputs.nkdAgility_ReleaseDescriptionState}} - nkdAgility_ReleaseDescription: ${{needs.Setup.outputs.nkdAgility_ReleaseDescription}} ### GitVersion - GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}} From 0e3cf12eb353f24b8df045043fc0c24f5cb48713 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:32:36 +0100 Subject: [PATCH 19/23] Test of | Out-File -FilePath $env:GITHUB_ENV -Append --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2213b70c..e70490900 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,10 +113,9 @@ jobs: $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} if ($description -eq $null) { $description = "No release description found"; - echo "release_description_state=false" >> $env:GITHUB_OUTPUT + "release_description_state=false" | Out-File -FilePath $env:GITHUB_ENV -Append } else { - echo "release_description_state=true" >> $env:GITHUB_OUTPUT - Write-Output "Release Description: $description" + "release_description_state=true" | Out-File -FilePath $env:GITHUB_ENV -Append } $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) "release_description<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append From b901c29a9b3a5365d24758f063c3237ad77ed923 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:34:23 +0100 Subject: [PATCH 20/23] Update labeler --- .github/workflows/labeler.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index dc3288e64..53434fcdf 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -9,6 +9,8 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v2 - uses: actions/create-github-app-token@v1 id: app-token with: From 46dc76f83594cac15050e7c3065992a0cc2253cc Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:37:13 +0100 Subject: [PATCH 21/23] Move back to echo --- .github/workflows/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e70490900..ddcbafd4e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,14 +113,15 @@ jobs: $description = Get-ReleaseDescription -mode log -OPEN_AI_KEY ${{ secrets.OPENAI_API_KEY }} if ($description -eq $null) { $description = "No release description found"; - "release_description_state=false" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "release_description_state=false" >> $env:GITHUB_OUTPUT } else { - "release_description_state=true" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "release_description_state=true" >> $env:GITHUB_OUTPUT + } $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) - "release_description<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append - $description | Out-File -FilePath $env:GITHUB_ENV -Append - "$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "release_description<<$EOF" >> $env:GITHUB_OUTPUT + echo $description >> $env:GITHUB_OUTPUT + echo "$EOF" >> $env:GITHUB_OUTPUT - uses: actions/upload-artifact@v4 From 77a9b91714f4bfd920117fbed0185bc167684c3e Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:42:59 +0100 Subject: [PATCH 22/23] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20remove=20red?= =?UTF-8?q?undant=20nkdAgility=5FReleaseDescription=20entry=20and=20reform?= =?UTF-8?q?at=20environment=20variables=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The redundant `nkdAgility_ReleaseDescription` entry is removed to avoid duplication and potential confusion. The environment variables section is reformatted for better readability and maintainability. --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ddcbafd4e..104bd5843 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -147,7 +147,7 @@ jobs: - nkdAgility_IsBuildEditBranch: ${{needs.Setup.outputs.nkdAgility_IsBuildEditBranch}} - nkdAgility_WingetApplicationId: ${{needs.Setup.outputs.nkdAgility_WingetApplicationId}} - nkdAgility_ReleaseDescriptionState: ${{needs.Setup.outputs.nkdAgility_ReleaseDescriptionState}} - - nkdAgility_ReleaseDescription: ${{needs.Setup.outputs.nkdAgility_ReleaseDescription}} + ### GitVersion - GitVersion_BranchName: ${{needs.Setup.outputs.GitVersion_BranchName}} - GitVersion_SemVer: ${{needs.Setup.outputs.GitVersion_SemVer}} @@ -159,6 +159,8 @@ jobs: - HasChanged_src: ${{needs.Setup.outputs.HasChanged_src}} - HasChanged_docs: ${{needs.Setup.outputs.HasChanged_docs}} - HasChanged_automation: ${{needs.Setup.outputs.HasChanged_automation}} + ## nkdAgility_ReleaseDescription + ${{needs.Setup.outputs.nkdAgility_ReleaseDescription}} "@ echo $markdown >> $Env:GITHUB_STEP_SUMMARY From ce562a2ce1ded4b4a03f5d62e77e830d27258dd3 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 15:47:42 +0100 Subject: [PATCH 23/23] =?UTF-8?q?=F0=9F=93=9D=20(Get-ReleaseDescription.ps?= =?UTF-8?q?1):=20update=20release=20instructions=20with=20GitHub=20reposit?= =?UTF-8?q?ory=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the GitHub repository link to the release instructions to provide a clear reference for users. This helps ensure that contributors know where to find the repository and can follow the correct guidelines for commits. --- build/include/Get-ReleaseDescription.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build/include/Get-ReleaseDescription.ps1 b/build/include/Get-ReleaseDescription.ps1 index defa35e0e..886cc9177 100644 --- a/build/include/Get-ReleaseDescription.ps1 +++ b/build/include/Get-ReleaseDescription.ps1 @@ -196,6 +196,7 @@ Instructions: 6. Aditional information: - Use the present tense. - Use en-gb for the commit message. + - Use https://github.com/nkdAgility/azure-devops-migration-tools as the github repository "@ # Set the API endpoint and API key