File tree Expand file tree Collapse file tree 4 files changed +43
-12
lines changed
Expand file tree Collapse file tree 4 files changed +43
-12
lines changed Original file line number Diff line number Diff line change 55# may be useful to set it to `true`.
66ACTIONS_STEP_DEBUG = true
77
8+ # E2E tests
9+
10+ CONFLUENCE_URL = https://confluence.tid.es
11+ CONFLUENCE_PAT = foo-access-token
12+ CONFLUENCE_README_PAGE_ID = foo-readme-page-id
13+ CONFLUENCE_CHANGELOG_PAGE_ID = foo-changelog-page-id
14+
815# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
916# Hyphens should not be converted to underscores!
1017INPUT_DOCS-DIR = " ./docs"
Original file line number Diff line number Diff line change @@ -10,28 +10,19 @@ This action syncs markdown files to Confluence using the [Markdown Confluence Sy
1010 - [ Tree operation mode] ( #tree-operation-mode )
1111 - [ Flat operation mode] ( #flat-operation-mode )
1212 - [ Id operation mode] ( #id-operation-mode )
13+ - [ Mermaid diagrams] ( #mermaid-diagrams )
1314- [ Configuration] ( #configuration )
1415 - [ Inputs] ( #inputs )
1516 - [ Configuration file] ( #configuration-file )
1617 - [ Environment variables] ( #environment-variables )
1718- [ Contributing] ( #contributing )
1819- [ License] ( #license )
1920
20-
21- ``` mermaid
22- graph TD;
23- A-->B;
24- A-->C;
25- B-->D;
26- C-->D;
27- E-->F;
28- ```
29-
3021## Features
3122
3223* It creates/updates/deletes [ Confluence] ( https://www.atlassian.com/es/software/confluence ) pages based on markdown files in a directory.
3324* Upload images to Confluence and update links in markdown files
34- * Supports Mermaid diagrams
25+ * Supports [ Mermaid diagrams] ( #mermaid-diagrams )
3526* Per-page configuration using [ frontmatter metadata] ( https://jekyllrb.com/docs/front-matter/ )
3627* Works great with [ Docusaurus] ( https://docusaurus.io/ )
3728* Three modes of operation:
@@ -151,6 +142,23 @@ confluence_page_id: 123456789
151142 confluence-personal-access-token: ${{ secrets.CONFLUENCE_PAT }}
152143` ` `
153144
145+ # ## Mermaid diagrams
146+
147+ Mermaid diagrams are supported in the markdown files. The action will render the diagrams as images and upload them to Confluence.
148+
149+ ` ` ` markdown
150+ ` ` ` mermaid
151+ graph TD;
152+ A-->B;
153+ A-->C;
154+ ```
155+
156+ ``` mermaid
157+ graph TD;
158+ A-->B;
159+ A-->C;
160+ ```
161+
154162## Configuration
155163
156164The action accepts a configuration file in the root of the repository, and it can be also configured using Github action inputs or even environment variables.
Original file line number Diff line number Diff line change 77 getChangelogPageTitle ,
88 getReadmePageTitle ,
99 getReadmePageChildren ,
10+ getReadmePageBody ,
1011} from "../support/confluence" ;
1112
1213describe ( "check sync" , ( ) => {
@@ -21,6 +22,13 @@ describe("check sync", () => {
2122 ) ;
2223 } ) ;
2324
25+ it ( "should have rendered mermaid diagram" , async ( ) => {
26+ const pageContent = await getReadmePageBody ( ) ;
27+ expect ( pageContent ) . toEqual ( expect . stringContaining ( '<img class="confluence-embedded-image"' ) ) ;
28+ expect ( pageContent ) . toEqual ( expect . stringContaining ( 'data-linked-resource-type="attachment"' ) ) ;
29+ expect ( pageContent ) . toEqual ( expect . stringMatching ( / d a t a - l i n k e d - r e s o u r c e - d e f a u l t - a l i a s = " a u t o g e n e r a t e d - ( \S ) * \. s v g " / ) ) ;
30+ } ) ;
31+
2432 it ( "should have one child" , async ( ) => {
2533 const pageChildren = await getReadmePageChildren ( ) ;
2634
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ async function getPageContent(id: string) {
3737/**
3838 * Returns the confluence content properties of the README page
3939 */
40- async function getReadmePageContent ( ) {
40+ export async function getReadmePageContent ( ) {
4141 return getPageContent ( README_PAGE_ID ) ;
4242}
4343
@@ -79,3 +79,11 @@ export async function getReadmePageTitle() {
7979 const content = await getReadmePageContent ( ) ;
8080 return content . title ;
8181}
82+
83+ /**
84+ * Returns the title of the README page
85+ */
86+ export async function getReadmePageBody ( ) {
87+ const content = await getReadmePageContent ( ) ;
88+ return content . body ?. view ?. value ;
89+ }
You can’t perform that action at this time.
0 commit comments