diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 936d2e9bbf15..1c23d3685bf4 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:2793e9664b2ad41670c953aad7ea552d0da414f6a486edd10655ae2d7da72093 + digest: sha256:33751ca85cc06cecb9ff2f6d7dc846e01664121d8842c9a7e45af649b02752e1 diff --git a/internal/postprocessor/main.go b/internal/postprocessor/main.go index af38f04cac6d..560ad13bb149 100644 --- a/internal/postprocessor/main.go +++ b/internal/postprocessor/main.go @@ -146,6 +146,9 @@ func (p *postProcessor) run(ctx context.Context) error { if err := p.InitializeNewModules(manifest); err != nil { return err } + if err := p.MoveSnippets(); err != nil { + return err + } prTitle, prBody, err := p.GetNewPRTitleAndBody(ctx) if err != nil { return err @@ -302,6 +305,28 @@ func (p *postProcessor) getDirs() []string { return dirs } +func (p *postProcessor) MoveSnippets() error { + log.Println("moving snippets") + dirs := p.getDirs() + for _, dir := range dirs { + + snpDirs, err := filepath.Glob(filepath.Join(dir, "apiv*", "internal")) + if err != nil { + return err + } + for _, snpDir := range snpDirs { + // TODO(chrisdsmith): Move to correct location in google-cloud-go/internal/generated/snippets + // instead of deleting. + log.Printf("deleting snippets dir: %s", snpDir) + err = os.RemoveAll(snpDir) + if err != nil { + return err + } + } + } + return nil +} + func (p *postProcessor) TidyAffectedMods() error { dirs := p.getDirs() for _, dir := range dirs {