Skip to content

Commit f6633b5

Browse files
authored
Release v1.1.0
Release v1.1.0
2 parents f4f01bb + 44c80d7 commit f6633b5

File tree

13 files changed

+19863
-602
lines changed

13 files changed

+19863
-602
lines changed

.github/workflows/test-e2e.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,27 @@ jobs:
2222
id: checkout
2323
uses: actions/checkout@v4
2424

25-
- name: Sync Readme
26-
id: sync-readme
25+
- name: Sync Docs
26+
id: sync-docs
2727
uses: ./
2828
with:
29-
mode: flat
29+
mode: id
3030
docs-dir: '.'
31-
files-pattern: 'README.md'
31+
files-pattern: '*.md'
32+
files-metadata: |
33+
[
34+
{
35+
"path": "README.md",
36+
"id": "${{ vars.CONFLUENCE_README_PAGE_ID }}",
37+
"title": "[Cross] [Markdown Confluence Sync] Github action"
38+
},
39+
{
40+
"path": "CHANGELOG.md",
41+
"id": "${{ vars.CONFLUENCE_CHANGELOG_PAGE_ID }}",
42+
"title": "[Cross] [Markdown Confluence Sync] [Github action] Releases"
43+
}
44+
]
3245
confluence-url: ${{ vars.CONFLUENCE_URL }}
33-
confluence-root-page-id: ${{ vars.CONFLUENCE_ROOT_PAGE_ID }}
34-
confluence-root-page-name: "Cross"
35-
confluence-space-key: ${{ vars.CONFLUENCE_SPACE_KEY }}
36-
confluence-personal-access-token: ${{ secrets.CONFLUENCE_PAT }}
37-
38-
- name: Sync Changelog
39-
id: sync-changelog
40-
uses: ./
41-
with:
42-
mode: flat
43-
docs-dir: '.'
44-
files-pattern: 'CHANGELOG.md'
45-
confluence-url: ${{ vars.CONFLUENCE_URL }}
46-
confluence-root-page-id: ${{ vars.CONFLUENCE_ROOT_PAGE_ID }}
47-
confluence-root-page-name: "Cross"
4846
confluence-space-key: ${{ vars.CONFLUENCE_SPACE_KEY }}
4947
confluence-personal-access-token: ${{ secrets.CONFLUENCE_PAT }}
5048

@@ -69,5 +67,5 @@ jobs:
6967
env:
7068
CONFLUENCE_URL: ${{ vars.CONFLUENCE_URL }}
7169
CONFLUENCE_PAT: ${{ secrets.CONFLUENCE_PAT }}
72-
CONFLUENCE_ROOT_PAGE_ID: ${{ vars.CONFLUENCE_ROOT_PAGE_ID }}
70+
CONFLUENCE_README_PAGE_ID: ${{ vars.CONFLUENCE_README_PAGE_ID }}
7371
CONFLUENCE_CHANGELOG_PAGE_ID: ${{ vars.CONFLUENCE_CHANGELOG_PAGE_ID }}

.vscode/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
settings.json

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
---
2-
sync_to_confluence: true
3-
title: "[Markdown Confluence Sync] [Github action] Releases"
4-
---
5-
61
# Changelog
72

83
All notable changes to this project will be documented in this file.
@@ -16,6 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1611
#### Deprecated
1712
#### Removed
1813

14+
## [1.1.0] - 2025-01-29
15+
16+
### Added
17+
18+
* feat: Add `files-metadata` input. It allows the user to provide a JSON array with the metadata of the files to be synchronized. This way, the user can set the Confluence id, title, etc. without the need to add frontmatter to the markdown files.
19+
* feat: Support `id` mode. It allows the user to provide a list of files to be synchronized only by their Confluence id.
20+
21+
### Changed
22+
23+
* chore(deps): Bump @tid-xcut/markdown-confluence-sync from 1.0.0 to 1.1.0 (Add id mode and filesMetadata option)
24+
1925
## [1.0.0] - 2024-11-28
2026

2127
### Added

README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
---
2-
sync_to_confluence: true
3-
title: "[Markdown Confluence Sync] Github action"
4-
confluence_page_id: "337906332"
5-
---
6-
71
# Markdown Confluence Sync action
82

93
This action syncs markdown files to Confluence using the [Markdown Confluence Sync](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/markdown-confluence-sync) library.
@@ -16,6 +10,7 @@ This action syncs markdown files to Confluence using the [Markdown Confluence Sy
1610
- [Markdown files to sync](#markdown-files-to-sync)
1711
- [Tree operation mode](#tree-operation-mode)
1812
- [Flat operation mode](#flat-operation-mode)
13+
- [Id operation mode](#id-operation-mode)
1914
- [Configuration](#configuration)
2015
- [Inputs](#inputs)
2116
- [Configuration file](#configuration-file)
@@ -30,19 +25,19 @@ This action syncs markdown files to Confluence using the [Markdown Confluence Sy
3025
* Supports Mermaid diagrams
3126
* Per-page configuration using [frontmatter metadata](https://jekyllrb.com/docs/front-matter/)
3227
* Works great with [Docusaurus](https://docusaurus.io/)
33-
* Two modes of operation:
28+
* Three modes of operation:
3429
* **tree**: Mirrors the hierarchical pages structure from given folder under a Confluence root page
35-
* **flat**: Synchronize a list of markdown files matched by a [glob pattern](https://github.com/isaacs/node-glob#glob-primer) as children page of a Confluence root page, without any hierarchy.
36-
* As an extra in this mode, a Confluence id can be provided to each page using frontmatter, and, in such case, the corresponding Confluence page will be updated, no matter if it is a child of the root page or not.
37-
30+
* **id**: Synchronize a list of markdown files matched by a [glob pattern](https://github.com/isaacs/node-glob#glob-primer) directly to specific Confluence pages using the Confluence id provided in the frontmatter metadata or in the configuration file.
31+
* **flat**: Synchronize a list of markdown files matched by a [glob pattern](https://github.com/isaacs/node-glob#glob-primer) as children page of a Confluence root page, without any hierarchy. It is also possible to provide a Confluence id to some pages to update them directly, as in the id mode.
32+
3833
> [!NOTE]
3934
> Read the [Markdown Confluence Sync library documentation](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/markdown-confluence-sync) for detailed information about all features and configuration options.
4035
4136
## Usage
4237

4338
### Markdown files to sync
4439

45-
First of all, your markdown files must have a frontmatter metadata block at the beginning of the file. This metadata block must be in YAML format and must contain at least the `title` and the `sync_to_confluence` fields. The `sync_to_confluence` field must be set to `true` to indicate that the page should be synchronized with Confluence.
40+
All the markdown files to be synced must have frontmatter properties "title" and "sync_to_confluence" set to true (unless you are using the `files-metadata` option). For example:
4641

4742
```markdown
4843
---
@@ -81,11 +76,49 @@ docs/
8176
> [!TIP]
8277
> Read the [tree mode docs](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/markdown-confluence-sync#tree-mode) for further information about configuration options and how to organize your markdown files.
8378
79+
### Id operation mode
80+
81+
If you want to update only specific pages directly by providing their id, you can use the id mode. In this mode, you don't need to provide a root page id. Each page in the list must have an id, and the library will update the corresponding Confluence page having the id provided. Note that the pages to update must exist in Confluence before running the sync process.
82+
83+
This mode is very useful when you want to update only a few pages, such as the README.md or the CHANGELOG.md files.
84+
85+
> [!TIP]
86+
> Use the `files-metadata` option to provide the data of the files to sync without having to modify the markdown files themselves.
87+
88+
For example:
89+
90+
```yaml
91+
- name: Sync markdown files to Confluence
92+
uses: Telefonica/markdown-confluence-sync-action@v1
93+
with:
94+
mode: id
95+
docs-dir: '.'
96+
files-pattern: '*.md'
97+
files-metadata: |
98+
[
99+
{
100+
"path": "README.md",
101+
"id": "123456789",
102+
"title": "My project README",
103+
"sync": true
104+
},
105+
{
106+
"path": "CHANGELOG.md",
107+
"id": "987654321",
108+
"title": "My project CHANGELOG",
109+
"sync": true
110+
}
111+
]
112+
confluence-url: 'https://your.confluence.es'
113+
confluence-space-key: 'YOUR-SPACE-KEY'
114+
confluence-personal-access-token: ${{ secrets.CONFLUENCE_PAT }}
115+
```
116+
84117
### Flat operation mode
85118

86119
You should use __flat__ mode in case your markdown files are not organized in a hierarchical structure and you want to synchronize all of them as children of a Confluence root page.
87120

88-
As an extra in this mode, a Confluence id can be provided to each page using frontmatter, and, in such case, the corresponding Confluence page will be updated, no matter if it is a child of the root page or not.
121+
As an extra in this mode, a Confluence id can be provided to some pages, as in the "id mode", to update them directly.
89122

90123
For example:
91124

@@ -124,9 +157,10 @@ The action accepts a configuration file in the root of the repository, and it ca
124157

125158
| Name | Description | Required | Default |
126159
|------|-------------|----------|---------|
127-
| `mode` | Operation mode: `tree` or `flat` | No | `tree` |
160+
| `mode` | Operation mode: `tree`, `id` or `flat` | No | `tree` |
128161
| `docs-dir` | Path to the directory containing the markdown files | __Yes__ | |
129-
| `files-pattern` | Pattern to filter the files to sync in flat mode | No | |
162+
| `files-metadata` | Array of objects with the metadata of the files to sync, expressed as an stringified JSON (supports multiline). Each object must have at least the `path` property for identifying the file. For the rest of properties read the [markdown-confluence-sync docs](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/markdown-confluence-sync#filesmetadata-property) | No | |
163+
| `files-pattern` | Pattern to filter the files to sync in flat or id mode | No | |
130164
| `confluence-url` | Confluence base URL | __Yes__ | |
131165
| `confluence-root-page-id` | ID of the Confluence page under which the pages will be synchronized | __Yes__ | |
132166
| `confluence-space-key` | Key of the Confluence space where the pages will be synced | __Yes__ | |
@@ -160,7 +194,7 @@ module.exports = {
160194
}
161195
```
162196

163-
> [!INFO]
197+
> [!NOTE]
164198
> Read the [Markdown Confluence Sync library docs](https://github.com/Telefonica/cross-confluence-tools/tree/main/components/markdown-confluence-sync#configuration-file) for further info about the configuration file.
165199

166200
### Environment variables

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ inputs:
2424
options:
2525
- 'flat'
2626
- 'tree'
27+
- 'id'
2728
files-pattern:
2829
description: 'Pattern to filter the files to sync in flat mode'
2930
type: string
31+
files-metadata:
32+
description: 'Metadata of the files to sync'
33+
type: string
34+
multiline: true
35+
required: false
3036
docs-dir:
3137
description: 'Path to the directory containing the markdown files'
3238
type: string

0 commit comments

Comments
 (0)