diff --git a/ogc/bblocks/entrypoint.py b/ogc/bblocks/entrypoint.py index ceca9ce..90c8915 100644 --- a/ogc/bblocks/entrypoint.py +++ b/ogc/bblocks/entrypoint.py @@ -158,10 +158,12 @@ base_url = args.base_url github_base_url = args.github_base_url + git_repo_path = None if not base_url or not github_base_url: try: import git repo = git.Repo() + git_repo_path = Path(repo.working_dir) remote_branch = repo.active_branch.tracking_branch() remote = repo.remote(remote_branch.remote_name) remote_url = next(remote.urls) @@ -190,7 +192,8 @@ github_base_url=github_base_url, imported_registers=imported_registers, bb_filter=args.filter, - steps=steps) + steps=steps, + git_repo_path=git_repo_path) # 2. Uplift register.json print(f"Running semantic uplift of {register_file}", file=sys.stderr) diff --git a/ogc/bblocks/postprocess.py b/ogc/bblocks/postprocess.py index f564c1a..af6b6c7 100644 --- a/ogc/bblocks/postprocess.py +++ b/ogc/bblocks/postprocess.py @@ -36,7 +36,8 @@ def postprocess(registered_items_path: str | Path = 'registereditems', imported_registers: list[str] | None = None, bb_filter: str | None = None, steps: list[str] | None = None, - bbr_config: dict | None = None) -> list[dict]: + bbr_config: dict | None = None, + git_repo_path: Path | None = None) -> list[dict]: cwd = Path().resolve() @@ -299,6 +300,8 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool: } if bbr_config.get('name'): output_register_json['name'] = bbr_config['name'] + elif git_repo_path: + output_register_json['name'] = git_repo_path.name if base_url: output_register_json['baseURL'] = base_url if full_validation_report_url: