Skip to content

Commit

Permalink
fix(internal/postprocessor): include module and package in scope (#7294)
Browse files Browse the repository at this point in the history
With this change the postprocessor includes the module in scopes for nested clients.
  • Loading branch information
adrianajg committed Jan 25, 2023
1 parent 19e9d03 commit d2c5c84
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion internal/postprocessor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 22 additions & 1 deletion internal/postprocessor/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {

Expand Down

0 comments on commit d2c5c84

Please sign in to comment.