Skip to content

Commit

Permalink
[Internal] Improve Changelog by grouping changes (#308)
Browse files Browse the repository at this point in the history
## Changes
Improve Changelog by grouping changes

## Tests
Recreated latest release Changelog:
```
Release v0.27.0

### Other Changes

 * Add `serverless_compute_id` field to the config ([#299](#299)).
 * Ignore DataPlane Services during generation ([#296](#296)).
 * Release v0.27.0 ([#301](#301)).
 * Retry failed integration tests ([#298](#298)).
 * Support partners in SDK ([#291](#291)).
 * Test parsing of error messages with `int` error codes ([#303](#303)).
 * Update OpenAPI spec ([#297](#297)).


### API Changes:

 * Added `workspaceClient.servingEndpointsDataPlane()` service.
 * Added `deploy()` and `start()` methods for `workspaceClient.apps()` service.
 * Added `batchGet()` method for `workspaceClient.consumerListings()` service.
 * Added `batchGet()` method for `workspaceClient.consumerProviders()` service.
 * Added `createSchedule()`, `createSubscription()`, `deleteSchedule()`, `deleteSubscription()`, `getSchedule()`, `getSubscription()`, `list()`, `listSchedules()`, `listSubscriptions()` and `updateSchedule()` methods for `workspaceClient.lakeview()` service.
 * Added `queryNextPage()` method for `workspaceClient.vectorSearchIndexes()` service.
 * Added `com.databricks.sdk.service.serving.AppDeploymentMode`, `com.databricks.sdk.service.serving.ModelDataPlaneInfo` and `com.databricks.sdk.service.serving.StartAppRequest` classes.
 * Added `com.databricks.sdk.service.catalog.CatalogIsolationMode` and `com.databricks.sdk.service.catalog.ListAccountStorageCredentialsResponse` classes.
 * Added `com.databricks.sdk.service.dashboards.CreateScheduleRequest`, `com.databricks.sdk.service.dashboards.CreateSubscriptionRequest`, `com.databricks.sdk.service.dashboards.CronSchedule`, `com.databricks.sdk.service.dashboards.DashboardView`, `com.databricks.sdk.service.dashboards.DeleteScheduleRequest`, `Object`, `com.databricks.sdk.service.dashboards.DeleteSubscriptionRequest`, `Object`, `com.databricks.sdk.service.dashboards.GetScheduleRequest`, `com.databricks.sdk.service.dashboards.GetSubscriptionRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsRequest`, `com.databricks.sdk.service.dashboards.ListDashboardsResponse`, `com.databricks.sdk.service.dashboards.ListSchedulesRequest`, `com.databricks.sdk.service.dashboards.ListSchedulesResponse`, `com.databricks.sdk.service.dashboards.ListSubscriptionsRequest`, `com.databricks.sdk.service.dashboards.ListSubscriptionsResponse`, `com.databricks.sdk.service.dashboards.Schedule`, `com.databricks.sdk.service.dashboards.SchedulePauseStatus`, `com.databricks.sdk.service.dashboards.Subscriber`, `com.databricks.sdk.service.dashboards.Subscription`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberDestination`, `com.databricks.sdk.service.dashboards.SubscriptionSubscriberUser` and `com.databricks.sdk.service.dashboards.UpdateScheduleRequest` classes.
 * Added `com.databricks.sdk.service.jobs.PeriodicTriggerConfiguration` and `com.databricks.sdk.service.jobs.PeriodicTriggerConfigurationTimeUnit` classes.
 * Added `com.databricks.sdk.service.marketplace.BatchGetListingsRequest`, `com.databricks.sdk.service.marketplace.BatchGetListingsResponse`, `com.databricks.sdk.service.marketplace.BatchGetProvidersRequest`, `com.databricks.sdk.service.marketplace.BatchGetProvidersResponse`, `com.databricks.sdk.service.marketplace.ProviderIconFile`, `com.databricks.sdk.service.marketplace.ProviderIconType` and `com.databricks.sdk.service.marketplace.ProviderListingSummaryInfo` classes.
 * Added `com.databricks.sdk.service.oauth2.DataPlaneInfo` class.
 * Added `com.databricks.sdk.service.vectorsearch.QueryVectorIndexNextPageRequest` class.
 * Added `isolationMode` field for `com.databricks.sdk.service.catalog.ExternalLocationInfo`.
 * Added `maxResults` and `pageToken` fields for `com.databricks.sdk.service.catalog.ListCatalogsRequest`.
 * Added `nextPageToken` field for `com.databricks.sdk.service.catalog.ListCatalogsResponse`.
 * Added `tableServingUrl` field for `com.databricks.sdk.service.catalog.OnlineTable`.
```
  • Loading branch information
hectorcast-db committed Jul 9, 2024
1 parent a618a4b commit bd40c04
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 6 deletions.
1 change: 1 addition & 0 deletions .codegen.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"formatter": "mvn spotless:apply",
"changelog_config": ".codegen/changelog_config.yml",
"template_libraries": [
".codegen/lib.tmpl"
],
Expand Down
44 changes: 38 additions & 6 deletions .codegen/changelog.md.tmpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Version changelog

## {{.Version}}
{{- range .GroupChanges}}

{{range .Changes -}}
### {{.Type.Message}}
{{range .Changes}}
* {{.}}.
{{end}}{{- if .ApiChanges}}
API Changes:
{{range .ApiChanges}}
* {{.Action}} {{template "what" .}}{{if .Extra}} {{.Extra}}{{with .Other}} {{template "what" .}}{{end}}{{end}}.
{{- end}}
{{end}}
{{if .ApiChanges}}
### API Changes:
{{range .ApiChanges.GroupDiff}}
* {{.Action}} {{template "group-what" .}}{{if .Extra}} {{.Extra}}{{with .Other}} {{template "other-what" .}}{{end}}{{end}}.
{{- end}}

OpenAPI SHA: {{.Sha}}, Date: {{.Changed}}
Expand All @@ -21,7 +25,35 @@ Dependency updates:

## {{.PrevVersion}}

{{- define "what" -}}
{{- define "group-what" -}}
{{if gt (len .Changes) 1 -}} {{template "single-what" .Changes.First}}{{end -}}
{{range .Changes.Middle -}}, {{template "single-what" .}}{{end -}}
{{if gt (len .Changes) 1}} and {{end}}{{template "single-what" .Changes.Last}}{{template "suffix-what" .}}
{{- end -}}

{{- define "single-what" -}}
{{if eq .X "package" -}}
`com.databricks.sdk.service.{{.Package.Name}}`
{{- else if eq .X "service" -}}
{{template "service" .Service}}
{{- else if eq .X "method" -}}
`{{.Method.CamelName}}()`
{{- else if eq .X "entity" -}}
{{template "entity" .Entity}}
{{- else if eq .X "field" -}}
`{{.Field.CamelName}}`
{{- end}}
{{- end -}}

{{- define "suffix-what" -}}
{{if eq .Type "package" }} package{{if gt (len .Changes) 1}}s{{end}}
{{- else if eq .Type "method" }} method{{if gt (len .Changes) 1}}s{{end}} for {{template "service" .Parent.Service}}
{{- else if eq .Type "entity" }} class{{if gt (len .Changes) 1}}es{{end}}
{{- else if eq .Type "field" }} field{{if gt (len .Changes) 1}}s{{end}} for {{template "entity" .Parent.Entity}}
{{- end}}
{{- end -}}

{{- define "other-what" -}}
{{if eq .X "package" -}}
`com.databricks.sdk.service.{{.Package.Name}}` package
{{- else if eq .X "service" -}}
Expand Down
11 changes: 11 additions & 0 deletions .codegen/changelog_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
change_types:
- message: New Features and Improvements
tag: "[Feature]"
- message: Bug Fixes
tag: "[Fix]"
- message: Documentation
tag: "[Doc]"
- message: Internal Changes
tag: "[Internal]"
# Default for messages without a tag
- message: Other Changes
19 changes: 19 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,22 @@ jobs:

- name: Check Unit Tests
run: mvn --errors test

commit-message:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Validate Tag
run: |
TAG=$(echo ${{ github.event.pull_request.title }} | sed -ne 's/\[\(.*\)\].*/\1/p')
if grep -q "tag: \"[$TAG]\"" .codegen/changelog_config.yml; then
echo "Invalid or missing tag in commit message: [$TAG]"
exit 1
else
echo "Valid tag found: [$TAG]"
fi
6 changes: 6 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if grep -q "tag: \"\[$TAG\]\"" .codegen/changelog_config.yml; then
echo "Match found."
else
echo "Match not found. Exiting..."
exit 1
fi

0 comments on commit bd40c04

Please sign in to comment.