Skip to content

Commit

Permalink
Bugfix: Docs - module and actions rendering (#614)
Browse files Browse the repository at this point in the history
* add logging

* more debugging

* https://arc.net/l/quote/pplohupq

* copy from .github

* further debugging

* Revert "copy from .github"

This reverts commit 7df0b98.

* use python 3.12

* try something

* try something

* fix actions

* cleanup

* troubleshooting

* remove gomplate version

* remove foo

* rename

* add /

* add /

* add /

* cleanup
  • Loading branch information
Benbentwo authored Jun 25, 2024
1 parent 50c5558 commit 54b349f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/docs-collator/GitHubActionRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __render_readme(self, module_download_dir, module_docs_dir):
f"README_FILE={readme_md_file}",
f"README_YAML={readme_yaml_file}",
f"README_TEMPLATE_YAML={readme_yaml_file}",
f"README_INCLUDES={module_download_dir}"], capture_output=True)
f"README_INCLUDES={module_download_dir}/"], capture_output=True)

if response.returncode != 0:
error_message = response.stderr.decode("utf-8")
Expand Down
3 changes: 2 additions & 1 deletion scripts/docs-collator/ModuleRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ def __render_readme(self, module_download_dir, module_docs_dir):

io.create_dirs(module_docs_dir)

logging.info(f"Running `make readme README_TEMPLATE_FILE={readme_tmpl_file} README_FILE={readme_md_file} README_YAML={readme_yaml_file} README_TEMPLATE_YAML={readme_yaml_file} README_INCLUDES={module_download_dir}`")
response = subprocess.run(["make", "readme",
f"README_TEMPLATE_FILE={readme_tmpl_file}",
f"README_FILE={readme_md_file}",
f"README_YAML={readme_yaml_file}",
f"README_TEMPLATE_YAML={readme_yaml_file}",
f"README_INCLUDES={module_download_dir}"], capture_output=True)
f"README_INCLUDES={module_download_dir}/"], capture_output=True)

if response.returncode != 0:
error_message = response.stderr.decode("utf-8")
Expand Down
4 changes: 2 additions & 2 deletions scripts/docs-collator/templates/github-actions/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- defineDatasource "config" .Env.README_YAML | regexp.Replace ".*" "" -}}
{{- defineDatasource "includes" .Env.README_INCLUDES | regexp.Replace ".*" "" -}}
{{- defineDatasource "config" .Env.README_YAML -}}
{{- defineDatasource "includes" (env.Getenv "README_INCLUDES") -}}
{{- $deprecated := has (ds "config") "deprecated" -}}
{{- $fullName := (ds "config").name -}}
{{- $shortName := (index ($fullName | strings.SplitN "-" 3) 2) -}}
Expand Down
7 changes: 4 additions & 3 deletions scripts/docs-collator/templates/modules/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- defineDatasource "config" .Env.README_YAML | regexp.Replace ".*" "" -}}
{{- defineDatasource "includes" .Env.README_INCLUDES | regexp.Replace ".*" "" -}}
{{- defineDatasource "config" .Env.README_YAML -}}
{{- defineDatasource "readmeIncludesDir" .Env.README_INCLUDES -}}
{{- $deprecated := has (ds "config") "deprecated" -}}
{{- $fullModuleName := (ds "config").name -}}
{{- $shortModuleName := (index ($fullModuleName | strings.SplitN "-" 3) 2) -}}
Expand All @@ -18,6 +18,7 @@ tags:
custom_edit_url: https://github.com/cloudposse/{{ $fullModuleName }}/edit/master/README.md
---


# Module: `{{ $shortModuleName }}`

{{- if $deprecated }}
Expand Down Expand Up @@ -75,7 +76,7 @@ custom_edit_url: https://github.com/cloudposse/{{ $fullModuleName }}/edit/master

{{ if has (ds "config") "include" }}
{{ range $file := (datasource "config").include -}}
{{ (include "includes" $file) }}
{{ (include "readmeIncludesDir" $file) }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 54b349f

Please sign in to comment.