diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 8de966e75d64..8a9b3cdfcfae 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-go:latest - digest: sha256:989e97271b91bb0bd869bd5d714d1ea076136090657aab7ba30635bfa1b38395 + digest: sha256:30a2b50c928425fceddf12f8e37a03fb7ca8cf0e63ee4b9807bed3dbfb79f323 diff --git a/internal/postprocessor/main.go b/internal/postprocessor/main.go index dbd39a57292d..84dcea7c49c3 100644 --- a/internal/postprocessor/main.go +++ b/internal/postprocessor/main.go @@ -363,7 +363,10 @@ func (c *config) getScopeFromGoogleapisCommitHash(commitHash string) (string, er for _, filePath := range files { for _, config := range generator.MicrogenGapicConfigs { if config.InputDirectoryPath == filepath.Dir(filePath) { - scope := config.Pkg + // trim prefix + scope := strings.TrimPrefix(config.ImportPath, "cloud.google.com/go/") + // trim version + scope = filepath.Dir(scope) if _, value := scopesMap[scope]; !value { scopesMap[scope] = true scopes = append(scopes, scope) diff --git a/internal/postprocessor/main_test.go b/internal/postprocessor/main_test.go index 86b4bf20187c..d52609dda51a 100644 --- a/internal/postprocessor/main_test.go +++ b/internal/postprocessor/main_test.go @@ -59,7 +59,7 @@ func TestProcessCommit(t *testing.T) { wantErr bool }{ { - name: "first test", + name: "test nested commits", title: "feat: [REPLACEME] Adds named reservation to InstancePolicy", body: `- [ ] Regenerate this pull request now. @@ -123,6 +123,27 @@ Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/5b3d3a550015e Copy-Tag: eyJwIjoiamF2YS1iYXRjaC8uT3dsQm90LnlhbWwiLCJoIjoiNWIzZDNhNTUwMDE1ZTkzNjdhZDEzZWU1ZjlmZWJlMGMzZjg0Y2YzMyJ9 END_NESTED_COMMIT`, }, + { + name: "test nested client scope", + title: "feat: [REPLACEME] added JSON_PACKAGE field to ExportAgentRequest", + body: `- [ ] Regenerate this pull request now. + + PiperOrigin-RevId: 504031208 + + Source-Link: https://github.com/googleapis/googleapis/commit/c6af392b613b435757358fac555628d84e443abd + + Source-Link: googleapis/googleapis-gen@7849764 + Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzg0OTc2NDc3NzYyZDk4YTljMzA4MzRkYzQ1ODVkODE1YWYyZmJmYiJ9`, + want: "feat(dialogflow/cx): added JSON_PACKAGE field to ExportAgentRequest", + want1: `- [ ] Regenerate this pull request now. + + PiperOrigin-RevId: 504031208 + + Source-Link: https://github.com/googleapis/googleapis/commit/c6af392b613b435757358fac555628d84e443abd + + Source-Link: googleapis/googleapis-gen@7849764 + Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzg0OTc2NDc3NzYyZDk4YTljMzA4MzRkYzQ1ODVkODE1YWYyZmJmYiJ9`, + }, } for _, tt := range tests {