From e26fa117cb43f7dcaf07f0bba7e33f424a68fbb4 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 10 Oct 2024 11:31:19 -0400 Subject: [PATCH 1/5] add chronus check to pipeline --- .../eng/scripts/Check-GitChanges.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 b/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 index c4bde91a49..7ea692db1e 100644 --- a/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 +++ b/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 @@ -20,3 +20,14 @@ Invoke-LoggedCommand "git -c core.safecrlf=false diff --ignore-space-at-eol --ex if($LastExitCode -ne 0) { throw "Changes detected" } + +# Get the current branch name +$currentBranch = git rev-parse --abbrev-ref HEAD + +# Check if the branch name starts with publish/, dependabot/, or backmerge/ +if ($currentBranch -notmatch '^(publish/|dependabot/|backmerge/)') { + Invoke-LoggedCommand "pnpm change verify" + if ($LastExitCode -ne 0) { + throw "Changelog verification failed" + } +} From 1799beb2b032cfcfaccdab90c9edbc8e5bae2a45 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 10 Oct 2024 11:33:45 -0400 Subject: [PATCH 2/5] update scripts in package.json --- packages/http-client-python/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/http-client-python/package.json b/packages/http-client-python/package.json index f10e8a5d29..ace6f9d8c2 100644 --- a/packages/http-client-python/package.json +++ b/packages/http-client-python/package.json @@ -41,7 +41,8 @@ "ci": "npm run test:emitter && npm run ci:generator --", "ci:generator": "tsx ./eng/scripts/ci/run-ci.ts", "test:generator": "tsx ./eng/scripts/ci/run-ci.ts --command=test", - "test:emitter": "vitest run -c ./emitter/vitest.config.ts" + "test:emitter": "vitest run -c ./emitter/vitest.config.ts", + "change": "chronus" }, "files": [ "dist/**", From 32faba7cfee19e0295c886d9efd0cb4a5f058b0c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 17 Oct 2024 14:57:57 -0400 Subject: [PATCH 3/5] try to add python-client version policy --- .chronus/config.yaml | 6 +++- .../eng/scripts/Check-GitChanges.ps1 | 33 ------------------- 2 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 packages/http-client-python/eng/scripts/Check-GitChanges.ps1 diff --git a/.chronus/config.yaml b/.chronus/config.yaml index 0db0cc476a..9e9e0821c1 100644 --- a/.chronus/config.yaml +++ b/.chronus/config.yaml @@ -55,13 +55,17 @@ versionPolicies: - "@typespec/sse" - "@typespec/streams" - "@typespec/xml" + - name: python-client + type: independent + step: patch + packages: + - "@typespec/http-client-python" changelog: ["@chronus/github/changelog", { repo: "microsoft/typespec" }] ignore: - "@typespec/http-client-csharp" - "@typespec/http-client-java" - - "@typespec/http-client-python" changedFiles: - "!**/*.md" diff --git a/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 b/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 deleted file mode 100644 index 7ea692db1e..0000000000 --- a/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 +++ /dev/null @@ -1,33 +0,0 @@ -#Requires -Version 7.0 - -param( - [string] $Exceptions -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 3.0 -$packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/') -. "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1" -Set-ConsoleEncoding - -$diffExcludes = @( - "$packageRoot/package.json" - "$packageRoot/package-lock.json" -) | ForEach-Object { "`":(exclude)$_`"" } | Join-String -Separator ' ' - -Invoke-LoggedCommand "git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- $diffExcludes" -IgnoreExitCode - -if($LastExitCode -ne 0) { - throw "Changes detected" -} - -# Get the current branch name -$currentBranch = git rev-parse --abbrev-ref HEAD - -# Check if the branch name starts with publish/, dependabot/, or backmerge/ -if ($currentBranch -notmatch '^(publish/|dependabot/|backmerge/)') { - Invoke-LoggedCommand "pnpm change verify" - if ($LastExitCode -ne 0) { - throw "Changelog verification failed" - } -} From 4a322add25636cbfb766709437b30c82206c100a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 17 Oct 2024 15:51:52 -0400 Subject: [PATCH 4/5] add changeset --- .chronus/changes/python-addChronus-2024-9-17-15-51-48.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/python-addChronus-2024-9-17-15-51-48.md diff --git a/.chronus/changes/python-addChronus-2024-9-17-15-51-48.md b/.chronus/changes/python-addChronus-2024-9-17-15-51-48.md new file mode 100644 index 0000000000..d6aa9a8bc7 --- /dev/null +++ b/.chronus/changes/python-addChronus-2024-9-17-15-51-48.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +add chronus to do version management \ No newline at end of file From 3dc90ec5a7ceee08de42aea16675b4292c16adab Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 17 Oct 2024 15:53:14 -0400 Subject: [PATCH 5/5] add back git changes bc of ci failure --- .../eng/scripts/Check-GitChanges.ps1 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/http-client-python/eng/scripts/Check-GitChanges.ps1 diff --git a/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 b/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 new file mode 100644 index 0000000000..c4bde91a49 --- /dev/null +++ b/packages/http-client-python/eng/scripts/Check-GitChanges.ps1 @@ -0,0 +1,22 @@ +#Requires -Version 7.0 + +param( + [string] $Exceptions +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 3.0 +$packageRoot = (Resolve-Path "$PSScriptRoot/../..").Path.Replace('\', '/') +. "$packageRoot/../../eng/emitters/scripts/CommandInvocation-Helpers.ps1" +Set-ConsoleEncoding + +$diffExcludes = @( + "$packageRoot/package.json" + "$packageRoot/package-lock.json" +) | ForEach-Object { "`":(exclude)$_`"" } | Join-String -Separator ' ' + +Invoke-LoggedCommand "git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- $diffExcludes" -IgnoreExitCode + +if($LastExitCode -ne 0) { + throw "Changes detected" +}