diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2ee0a6..5ea2e37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: @@ -48,7 +48,7 @@ jobs: permissions: contents: read id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -95,7 +95,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/courier-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 26e35c4..faa0df4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.11.2" + ".": "3.12.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9e3b99b..4417498 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 138 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-11e1931d767cef402bbed5a965746d1933ae72db0f41881860593a0b1424fd80.yml -openapi_spec_hash: 9def941805f233f8761c4bdae88f6137 -config_hash: 6c3a754258f0f77e9032a90a478ab76d +configured_endpoints: 139 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-b03f5346718dcd7b22f15893445ea593ab87535c90c540fc5a796c6ecd54d779.yml +openapi_spec_hash: 15677d3be4ecd33eab154080b4bc437f +config_hash: dcd58abf1e56b114bdce22336ca3d570 diff --git a/CHANGELOG.md b/CHANGELOG.md index 082dd64..3cccc47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.12.0 (2026-07-20) + +Full Changelog: [v3.11.2...v3.12.0](https://github.com/trycourier/courier-cli/compare/v3.11.2...v3.12.0) + +### Features + +* Document POST /notifications/{id}/duplicate [C-18607] ([#165](https://github.com/trycourier/courier-cli/issues/165)) ([3e1c7f9](https://github.com/trycourier/courier-cli/commit/3e1c7f937cdef899737f99a5b3d5563ce2314ebf)) +* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([7cd231c](https://github.com/trycourier/courier-cli/commit/7cd231c7cb4917b51abdc1d2f7d4851a280d8116)) + ## 3.11.2 (2026-07-10) Full Changelog: [v3.11.1...v3.11.2](https://github.com/trycourier/courier-cli/compare/v3.11.1...v3.11.2) diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 7ae6cea..fbbf72c 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -286,6 +286,7 @@ func init() { ¬ificationsRetrieve, ¬ificationsList, ¬ificationsArchive, + ¬ificationsDuplicate, ¬ificationsListVersions, ¬ificationsPublish, ¬ificationsPutContent, diff --git a/pkg/cmd/notification.go b/pkg/cmd/notification.go index c6b6c92..d84129a 100644 --- a/pkg/cmd/notification.go +++ b/pkg/cmd/notification.go @@ -128,6 +128,21 @@ var notificationsArchive = cli.Command{ HideHelpCommand: true, } +var notificationsDuplicate = cli.Command{ + Name: "duplicate", + Usage: "Duplicate a notification template. Creates a standalone copy within the same\nworkspace and environment, with \" COPY\" appended to the title. The copy clones\nthe source draft's tags, brand, subscription topic, routing strategy, channels,\nand content, and is always created as a standalone template (it is not linked to\nany journey or broadcast, even if the source was). Templates that are scoped to\na journey or a broadcast cannot be duplicated through this endpoint.", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "id", + Required: true, + PathParam: "id", + }, + }, + Action: handleNotificationsDuplicate, + HideHelpCommand: true, +} + var notificationsListVersions = cli.Command{ Name: "list-versions", Usage: "List versions of a notification template.", @@ -540,6 +555,48 @@ func handleNotificationsArchive(ctx context.Context, cmd *cli.Command) error { return client.Notifications.Archive(ctx, cmd.Value("id").(string), options...) } +func handleNotificationsDuplicate(ctx context.Context, cmd *cli.Command) error { + client := courier.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("id") && len(unusedArgs) > 0 { + cmd.Set("id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Notifications.Duplicate(ctx, cmd.Value("id").(string), options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "notifications duplicate", + Transform: transform, + }) +} + func handleNotificationsListVersions(ctx context.Context, cmd *cli.Command) error { client := courier.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/notification_test.go b/pkg/cmd/notification_test.go index 1c7bbb0..27553f0 100644 --- a/pkg/cmd/notification_test.go +++ b/pkg/cmd/notification_test.go @@ -114,6 +114,18 @@ func TestNotificationsArchive(t *testing.T) { }) } +func TestNotificationsDuplicate(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "notifications", "duplicate", + "--id", "id", + ) + }) +} + func TestNotificationsListVersions(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 24bb894..5c0c761 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "3.11.2" // x-release-please-version +const Version = "3.12.0" // x-release-please-version