From ffd612bcdfca6f598b0ee75c1c7e75a3250b04bb Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Tue, 23 Sep 2025 14:54:37 -0700 Subject: [PATCH 1/2] Update pulumi-command shortcode to use local file The `pulumi-command` shortcode is used to emit an inline copy of the CLI's root command docs, which is referenced on a couple pages: - https://www.pulumi.com/docs/iac/cli/ - https://www.pulumi.com/docs/iac/cli/commands/ Originally, this shortcode simply opened the local file. Then when the docs were split between pulumi/docs and pulumi/pulumi-hugo repos, the shortcode was changed to make an API request to GitHub to grab the file's content from the docs repo. We've since merged these two repos back into the single pulumi/docs repo, so there's no longer a need to make a network request to get the content. We can go back to just reading the file. Which is what this change does. --- layouts/shortcodes/pulumi-command.html | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/layouts/shortcodes/pulumi-command.html b/layouts/shortcodes/pulumi-command.html index c144a83a06d6..2c7a87caf07c 100644 --- a/layouts/shortcodes/pulumi-command.html +++ b/layouts/shortcodes/pulumi-command.html @@ -1,16 +1,5 @@ -{{/* Fetch the current version of the Pulumi CLI doc." suffix. */}} -{{ $headers := dict }} -{{ with (os.Getenv "GITHUB_TOKEN") }} - {{ $token := printf "Bearer %s" . }} - {{ $headers = (dict "Authorization" $token) }} -{{ end }} - -{{- $json := resources.GetRemote "https://api.github.com/repos/pulumi/docs/contents/content/docs/iac/cli/commands/pulumi.md" $headers }} -{{ with $json }} - {{ $data := . | transform.Unmarshal }} - {{ $content := base64Decode $data.content }} - {{/* Remove front matter and "Auto generated by..." suffix. */}} - {{- $content = replaceRE "(?s)---.*---" "" $content -}} - {{- $content = replaceRE "(?m)^###### Auto generated by .*$" "" $content -}} - {{- markdownify $content -}} -{{ end }} +{{- $content := readFile "/docs/iac/cli/commands/pulumi.md" -}} +{{/* Remove front matter and "Auto generated by..." suffix. */}} +{{- $content = replaceRE "(?s)---.*---" "" $content -}} +{{- $content = replaceRE "(?m)^###### Auto generated by .*$" "" $content -}} +{{- markdownify $content -}} From 36a4deab62ff0580619ad3e429084f8cd30fe0fd Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Tue, 23 Sep 2025 15:15:37 -0700 Subject: [PATCH 2/2] Address feedback Claude suggests using `content/docs/iac/cli/commands/pulumi.md` rather than `/docs/iac/cli/commands/pulumi.md` (either work). --- layouts/shortcodes/pulumi-command.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/pulumi-command.html b/layouts/shortcodes/pulumi-command.html index 2c7a87caf07c..ca9a74746edf 100644 --- a/layouts/shortcodes/pulumi-command.html +++ b/layouts/shortcodes/pulumi-command.html @@ -1,4 +1,4 @@ -{{- $content := readFile "/docs/iac/cli/commands/pulumi.md" -}} +{{- $content := readFile "content/docs/iac/cli/commands/pulumi.md" -}} {{/* Remove front matter and "Auto generated by..." suffix. */}} {{- $content = replaceRE "(?s)---.*---" "" $content -}} {{- $content = replaceRE "(?m)^###### Auto generated by .*$" "" $content -}}