feat: enhance publish-to-confluence with frontmatter write-back, code macros, and reliability fixes#15
Open
orangit-timo-aho wants to merge 1 commit into
Open
Conversation
Merged features from template/publish-to-confluence into platform-tooling to establish platform-tooling as the canonical action going forward. ## Frontmatter write-back (confluence_url + page_id) After a successful publish, the source .md file gains confluence_url and page_id in its YAML frontmatter. Eliminates hunting for the Confluence page after a push; enables downstream CI steps and Jira links to reference the exact page without a title search. ## Code block -> Confluence macro Fenced code blocks are converted to ac:structured-macro code blocks with syntax highlighting (30+ language aliases) and line numbers. Previously published as unstyled <pre> text. ## Direct REST PUT for page updates Replaces conf.update_page() with a manually constructed PUT that includes the space key Confluence Cloud requires. Eliminates sporadic 400 ApiValueError failures that left runs partially complete. ## Ghost page cleanup On title conflict during create, the script searches across draft/trashed/ archived statuses, deletes the blocking ghost page, and retries. Previously required manual intervention in Confluence UI to clear the conflict. ## Space-wide folder title fallback get_or_create_folder_page now falls back to a space-wide title search if the folder page is not found among the parent's children. Prevents duplicate folder pages being created on partial re-runs or across workflow instances. ## Multi-format image upload Image attachments now support .svg, .gif, .webp, .jpg, .bmp, .ico in addition to .png, with correct MIME types. SVG diagrams from draw.io and other formats previously failed silently and appeared broken in Confluence. ## Redundant index.md deduplication foo/index.md is skipped when foo.md exists at the same level, preventing duplicate Confluence pages (e.g. 'Adr' and 'Adr - Overview') for the same section. ## Selective publish (files= parameter) publish_docs() accepts an optional files list. Enables a future workflow pattern where only changed .md files are published per push, reducing Confluence API calls and workflow runtime significantly. ## Mermaid integration (Option B - per-file pipeline) Mermaid rendering via mmdc is now fully encapsulated in publish_single_file. PNG attachments from render_mermaid_diagrams are converted to ac:image macros via a dedicated _replace_mermaid_img_tags helper before the generic image handler runs. Blocks that mmdc cannot render fall through to the CloudScript macro fallback.
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.
Summary
Significantly improves the
publish-to-confluenceaction with new features, reliability fixes, and expanded format support.Changes
Frontmatter write-back (
confluence_url+page_id)After a successful publish, the source
.mdfile gainsconfluence_urlandpage_idin its YAML frontmatter. Eliminates hunting for the Confluence page after a push; enables downstream CI steps and Jira links to reference the exact page without a title search.Code block → Confluence macro
Fenced code blocks are converted to
ac:structured-macrocode blocks with syntax highlighting (30+ language aliases) and line numbers. Previously published as unstyled<pre>text.Direct REST PUT for page updates
Replaces
conf.update_page()with a manually constructed PUT that includes the space key Confluence Cloud requires. Eliminates sporadic400 ApiValueErrorfailures that left runs partially complete.Ghost page cleanup
On title conflict during create, the script searches across draft/trashed/archived statuses, deletes the blocking ghost page, and retries. Previously required manual intervention in Confluence UI to clear the conflict.
Space-wide folder title fallback
get_or_create_folder_pagenow falls back to a space-wide title search if the folder page is not found among the parent's children. Prevents duplicate folder pages on partial re-runs or across workflow instances.Multi-format image upload
Image attachments now support
.svg,.gif,.webp,.jpg,.bmp,.icoin addition to.pngwith correct MIME types.Redundant
index.mddeduplicationfoo/index.mdis skipped whenfoo.mdexists at the same level, preventing duplicate Confluence pages for the same section.Selective publish (
files=parameter)publish_docs()accepts an optionalfileslist, enabling workflows where only changed.mdfiles are published per push.Mermaid integration
Mermaid rendering via
mmdcis fully encapsulated per-file. PNG attachments are converted toac:imagemacros before the generic image handler runs. Blocks thatmmdccannot render fall through to the CloudScript macro fallback.