Skip to content

Commit 314c828

Browse files
chore: prepare for monorepo migration (#252)
* chore: prepare for monorepo migration * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * restore docs/index.rst --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 4449dc3 commit 314c828

22 files changed

Lines changed: 2177 additions & 57 deletions

packages/google-cloud-workflows/.github/.OwlBot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ deep-remove-regex:
2020

2121
deep-copy-regex:
2222
- source: /google/cloud/workflows/executions/(v.*)/.*-py/(.*)
23-
dest: /owl-bot-staging/executions/$1/$2
23+
dest: /owl-bot-staging/$1/$2
2424
- source: /google/cloud/workflows/(v.*)/.*-py/(.*)
25-
dest: /owl-bot-staging/workflows/$1/$2
25+
dest: /owl-bot-staging/$1/$2
2626

2727
begin-after-commit-hash: acb4b773a6df45f9303067ffcb21387a7b6ad40d
2828

packages/google-cloud-workflows/owlbot.py

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import json
16-
from typing import List, Optional
1716
from pathlib import Path
1817
import shutil
1918

@@ -32,61 +31,12 @@
3231
"default_version"
3332
)
3433

35-
# This is a customized version of the s.get_staging_dirs() function from synthtool to
36-
# cater for copying 2 different folders from googleapis-gen
37-
# which are workflows and workflows/executions
38-
# Source https://github.com/googleapis/synthtool/blob/master/synthtool/transforms.py#L280
39-
def get_staging_dirs(
40-
default_version: Optional[str] = None, sub_directory: Optional[str] = None
41-
) -> List[Path]:
42-
"""Returns the list of directories, one per version, copied from
43-
https://github.com/googleapis/googleapis-gen. Will return in lexical sorting
44-
order with the exception of the default_version which will be last (if specified).
45-
46-
Args:
47-
default_version (str): the default version of the API. The directory for this version
48-
will be the last item in the returned list if specified.
49-
sub_directory (str): if a `sub_directory` is provided, only the directories within the
50-
specified `sub_directory` will be returned.
51-
52-
Returns: the empty list if no file were copied.
53-
"""
54-
55-
staging = Path("owl-bot-staging")
56-
57-
if sub_directory:
58-
staging /= sub_directory
59-
60-
if staging.is_dir():
61-
# Collect the subdirectories of the staging directory.
62-
versions = [v.name for v in staging.iterdir() if v.is_dir()]
63-
# Reorder the versions so the default version always comes last.
64-
versions = [v for v in versions if v != default_version]
65-
versions.sort()
66-
if default_version is not None:
67-
versions += [default_version]
68-
dirs = [staging / v for v in versions]
69-
for dir in dirs:
70-
s._tracked_paths.add(dir)
71-
return dirs
72-
else:
73-
return []
74-
75-
76-
for library in get_staging_dirs(default_version, "executions"):
77-
# Make sure this library is named 'google-cloud-workflows'
78-
s.replace(
79-
library / "google/**/*.py", "google-cloud-workflows-executions", "google-cloud-workflows"
80-
)
81-
s.move([library], excludes=["**/gapic_version.py", "docs/index.rst"])
82-
83-
# move workflows after executions, since we want to use "workflows" for the name
84-
for library in get_staging_dirs(default_version, "workflows"):
34+
for library in s.get_staging_dirs(default_version):
8535
if clean_up_generated_samples:
8636
shutil.rmtree("samples/generated_samples", ignore_errors=True)
8737
clean_up_generated_samples = False
88-
s.move([library], excludes=["**/gapic_version.py", "docs/index.rst"])
8938

39+
s.move([library], excludes=["**/gapic_version.py"])
9040
s.remove_staging_dirs()
9141

9242
# ----------------------------------------------------------------------------
@@ -98,7 +48,7 @@ def get_staging_dirs(
9848
microgenerator=True,
9949
versions=gcp.common.detect_versions(path="./google", default_first=True),
10050
)
101-
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml", "docs/index.rst"])
51+
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"])
10252

10353
python.py_samples(skip_readmes=True)
10454

0 commit comments

Comments
 (0)