docs: add PR build validation, pin Hugo to 0.124.1, scope deploy permissions#59
Merged
Merged
Conversation
…y permissions Agent-Logs-Url: https://github.com/crossplane-contrib/function-hcl/sessions/a491feb4-d0e2-44d3-9dbe-33559e6e83f6 Co-authored-by: gotwarlost <1056819+gotwarlost@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update GitHub Actions workflow for docs publishing
docs: add PR build validation, pin Hugo to 0.124.1, scope deploy permissions
May 15, 2026
Signed-off-by: gotwarlost <krishnan.anantheswaran@elastic.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs workflow only ran on tag pushes, meaning Hugo build failures weren't caught until release. Additionally,
hugo-version: 'latest'pulled Hugo v0.161.1 which is incompatible with Docsy v0.10.0, causing render failures.Changes
pull_requesttrigger — docs build now runs on every PR using the same checkout/setup/npm/Hugo steps as release builds0.124.1— fixes the render failure caused by Docsy incompatibility withlatest(v0.161.1)if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'); PRs are validation-onlydeployjob to tag pushes — same condition on the job itself; Pages deployment never runs for PRsdeployjob — top-level reduced tocontents: read;pages: writeandid-token: writedeclared only on thedeployjobOriginal prompt
Update the GitHub Actions workflow for docs publishing in the repository
crossplane-contrib/function-hclso that docs are built for every pull request using the same build steps as the release docs workflow, but without any publishing/deployment on PRs.Context:
.github/workflows/docs.yml.v*) andworkflow_dispatch.buildjob performs checkout, Go setup, Hugo setup, Node setup, npm install, Pages configuration, and Hugo build.deployjob publishes to GitHub Pages.hugo-version: 'latest', which pulled Hugov0.161.1and appears incompatible with the Docsy version in use. The workflow should pin Hugo to0.124.1.Required changes:
.github/workflows/docs.ymlso the workflow also triggers onpull_request.buildjob that runs on both PRs and release tag pushes.deployjob only runs on tag pushes wheregithub.refstarts withrefs/tags/v.contents: read.deployjob should declarepages: writeandid-token: writepermissions.actions/upload-pages-artifacton PR runs, since PRs are for validation only.latestto0.124.1.Acceptance criteria:
v*still build and deploy successfully.Please create a pull request with these workflow changes against the
mainbranch.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is in the docs build job, specifically the Hugo render step in the Pages workflow:
.github/workflows/docs.ymlBuild with HugoThe key error from the logs is:
ERROR error building site: render: [en v1.0.0 guest] failed to render pages: render of "/404" failedgithub.com/google/docsy@v0.10.0/layouts/_default/baseof.html:4:7skipping template file ... td-render-heading.html: unrecognized render hook templateMost likely fix
This looks like a Hugo/Docsy compatibility issue, caused by the workflow using:
Using
latestpulled Hugo v0.161.1, which is likely too new for the pinned Docsy version (github.com/google/docsy@v0.10.0) referenced in the logs.Recommended change
Pin Hugo to a version known to work with Docsy 0.10.x instead of using
latest.Update
.github/workflows/docs.ymlfrom:to something like:
If your docs site was previously working on a different Hugo release, pin to that exact version instead.
Why this should solve it
td-render-heading.htmlbeing an “unrecognized render hook template” is a strong sign that the installed Hugo version and the theme/module version are out of sync.Optional follow-up improvement
To avoid this recurring, keep both sides aligned:
But the fastest fix for this job is to stop using
latestand pin Hugo.Patch suggestion