From da025c694aaaeb060390f5de324a9defe57231f3 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 17:18:17 +0100 Subject: [PATCH 1/6] fix(main.yml): replace GITHUB_TOKEN with NKD_MRHINSH_TOKEN in Winget Release script to use the correct authentication token --- .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 037896471..f92cb0d0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -379,7 +379,7 @@ jobs: - name: "Winget Release" shell: pwsh run: | - .\build\releaseWingetPackage.ps1 -version ${{ needs.Setup.outputs.GitVersion_SemVer }} -ring ${{needs.Setup.outputs.nkdAgility_Ring}} -GH_TOKEN ${{ secrets.GITHUB_TOKEN }} + .\build\releaseWingetPackage.ps1 -version ${{ needs.Setup.outputs.GitVersion_SemVer }} -ring ${{needs.Setup.outputs.nkdAgility_Ring}} -GH_TOKEN ${{ secrets.NKD_MRHINSH_TOKEN }} # Release to Docs DocsRelease: From 6127eea732eac40da412ce76c8c033951b763804 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 17:21:04 +0100 Subject: [PATCH 2/6] fix(main.yml): remove wildcard branch trigger in GitHub Actions workflow to prevent unnecessary workflow runs on all branches --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f92cb0d0f..db8da6af8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,6 @@ permissions: on: push: branches: - - "*" tags: - '!v*-*' pull_request: From e12182d73418fa7a8eaf265bc1aa5ad37e20d0fb Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 17:23:54 +0100 Subject: [PATCH 3/6] fix(main.yml): correct choco push command by removing .FullName from $chocoFile to avoid potential path issues --- .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 db8da6af8..88031621f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -356,7 +356,7 @@ jobs: Write-Output $"Running with {$chocoFile}" } - choco push $chocoFile.FullName --version $NuGetVersion --key ${{ secrets.CHOCO_APIKEY }} --source https://push.chocolatey.org/ + choco push "$chocoFile" --version $NuGetVersion --key ${{ secrets.CHOCO_APIKEY }} --source https://push.chocolatey.org/ # Release to Winget From 0e2e6c545d26e3a1bbe60108f9dc2c4fba9a668a Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 17:29:37 +0100 Subject: [PATCH 4/6] feat(.github/workflows): add open-pr-describer.yml to generate PR descriptions using OpenAI feat(MigrationTools.sln): include open-pr-describer.yml in solution items for visibility and easy access --- .github/workflows/open-pr-describer.yml | 22 ++++++++++++++++++++++ MigrationTools.sln | 1 + 2 files changed, 23 insertions(+) create mode 100644 .github/workflows/open-pr-describer.yml diff --git a/.github/workflows/open-pr-describer.yml b/.github/workflows/open-pr-describer.yml new file mode 100644 index 000000000..5e5fa4e65 --- /dev/null +++ b/.github/workflows/open-pr-describer.yml @@ -0,0 +1,22 @@ +name: OpenAI PR Description Generator + +on: + pull_request: + types: + - opened + - synchronize + +permissions: + pull-requests: write + contents: read + +jobs: + pull-request: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: Ant0wan/openai-pr@v1 + with: + api-key: ${{ secrets.OPENAI_API_KEY }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/MigrationTools.sln b/MigrationTools.sln index 3852462fd..71c4a0e90 100644 --- a/MigrationTools.sln +++ b/MigrationTools.sln @@ -92,6 +92,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".workflows", ".workflows", ProjectSection(SolutionItems) = preProject .github\workflows\code-review.yml = .github\workflows\code-review.yml .github\workflows\main.yml = .github\workflows\main.yml + .github\workflows\open-pr-describer.yml = .github\workflows\open-pr-describer.yml .github\workflows\opencommit.yml = .github\workflows\opencommit.yml .github\workflows\stale.yml = .github\workflows\stale.yml EndProjectSection From bfb4d4cf540f13594d334b12f6d549bf6b913787 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 17:41:02 +0100 Subject: [PATCH 5/6] refactor(github workflows): replace env variables with secrets for app-id and private-key in code-review.yml and main.yml This change is done to enhance security by using GitHub secrets instead of environment variables for sensitive data. --- .github/workflows/code-review.yml | 4 ++-- .github/workflows/main.yml | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml index e49834851..9bba61e62 100644 --- a/.github/workflows/code-review.yml +++ b/.github/workflows/code-review.yml @@ -15,8 +15,8 @@ jobs: - uses: actions/create-github-app-token@v1 id: app-token with: - app-id: ${{ env.APP_ID }} - private-key: ${{ env.PRIVATE_KEY }} + app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }} + private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} - uses: fitomad/github-chatgpt-integration@main with: openai-api-key: ${{ secrets.OPENAI_API_KEY }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88031621f..5050c7845 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,10 +18,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - APP_ID: "Iv23li9aYvt0VW9x4Jhh" - PRIVATE_KEY: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} - defaults: run: shell: pwsh @@ -261,8 +257,8 @@ jobs: - uses: actions/create-github-app-token@v1 id: app-token with: - app-id: ${{ env.APP_ID }} - private-key: ${{ env.PRIVATE_KEY }} + app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }} + private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }} - name: "Package Files" shell: pwsh run: | From 58c2e787e6dacb3e1e18dc4ea8e8e6b14e43ef68 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 16 Jul 2024 18:00:26 +0100 Subject: [PATCH 6/6] feat(main.yml): add new environment variables HasChanged_src, HasChanged_docs, HasChanged_automation to track changes in specific directories fix(main.yml): modify release-options condition to check for changes in src and docs directories before making an announcement, ensuring unnecessary announcements are avoided --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5050c7845..76fb00b04 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -248,6 +248,9 @@ jobs: GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }} GitVersion_NuGetVersion: ${{ needs.Setup.outputs.GitVersion_NuGetVersion }} GitVersion_PreReleaseLabel: ${{ needs.Setup.outputs.GitVersion_PreReleaseLabel }} + HasChanged_src: ${{ needs.Setup.outputs.HasChanged_src }} + 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' ) }} steps: @@ -267,7 +270,7 @@ jobs: id: release-options shell: pwsh run: | - if ($Env:nkdAgility_Ring -ne 'Canary') { + if ($Env:nkdAgility_Ring -ne 'Canary' && ($Env:HasChanged_src || $Env:HasChanged_docs )) { echo "discussion_category_name=Anouncement" >> $env:GITHUB_OUTPUT } - name: Release