Skip to content

Commit 45e9709

Browse files
Merge pull request #2 from lazybytez/feature/implement-action
Implement the Action
2 parents 542078d + 5f76d06 commit 45e9709

10 files changed

+19167
-20
lines changed

README.md

+80-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
# Sync Markdown to BookStack Action
2+
3+
[![gh-commit-badge][gh-commit-badge]][gh-commit]
4+
[![gh-contributors-badge][gh-contributors-badge]][gh-contributors]
5+
[![gh-stars-badge][gh-stars-badge]][gh-stars]
6+
7+
## Description
28
This action allows to synchronize one or more markdown files to BookStack.
39
This makes it possible to maintain documentation within a repository while still
410
making it available in your central documentation solution.
511

612
This action features:
713
- Sync to either a chapter or a book
814
- Use either a single file or a glob pattern to sync multiple files
9-
- Add tags to the generated pages
1015
- Keep your pages up to date - the action can create and update pages
1116

17+
## Limitations
18+
- To support globs and therefore the creation of multiple pages at once, this action uses the **first** headline of type **# (h1)** as the name for the pages
19+
- Your markdown files **must** have at least one **#** to be accepted by the Action
20+
- The sync is currently one way, so deleting files from the repo won't delete the pages from BookStack
21+
- We always push an update to BookStack which generates additional traffic, however, BookStack won't create additional revisions if the content is unchanged
22+
- You must grab the book/chapter id from the database or using the API to configure the action
23+
1224
## Inputs
1325

14-
### `bookstack-url`
26+
### `url`
1527
- **Required**
1628
- The URL to your BookStack instance, where the files will be synced to.
1729

18-
### `bookstack-token-id`
30+
### `token-id`
1931
- **Required**
2032
- The id of your BookStack API connection.
2133

22-
### `bookstack-token-secret`
34+
### `token-secret`
2335
- **Required**
2436
- The secret of your BookStack API connection.
2537

@@ -31,9 +43,6 @@ This action features:
3143
- **Required, when `book-id` is not set**
3244
- The ID of the book to sync to.
3345

34-
### `tags`
35-
- The tags to add to the page, comma separated
36-
3746
### `path`
3847
- The path to the markdown file(s) to sync, you can use glob patterns for multiple files
3948

@@ -51,8 +60,70 @@ with:
5160
# You only need one of book-id or chapter-id
5261
book-id: 123
5362
chapter-id: 123
54-
tags: 'action,sync,bookstack'
5563
# You can either use a path to a file or a glob pattern:
5664
path: 'sub/directories/README.md'
5765
path: 'sub/*/*.md'
58-
```
66+
```
67+
68+
## Development
69+
To develop locally, you should install **NodeJS 20**.
70+
71+
The following commands can be used for local development:
72+
```
73+
# Install dependencies
74+
$ npm install
75+
76+
# Format and bundle for distribution
77+
$ npm run bundle
78+
79+
# Only check code style using prettier
80+
$ npm run format:check
81+
82+
# Check code style and reformat
83+
$ npm run format:write
84+
```
85+
86+
Be sure to always run the bundler and commit the `dist/` directory when doing changes to the code.
87+
88+
## Contributing
89+
90+
If you want to take part in contribution, like fixing issues and contributing directly to the code base, please visit
91+
the [How to Contribute][gh-contribute] document.
92+
93+
## Useful links
94+
95+
[License][gh-license] -
96+
[Contributing][gh-contribute] -
97+
[Code of conduct][gh-codeofconduct] -
98+
[Issues][gh-issues] -
99+
[Pull requests][gh-pulls]
100+
101+
<hr>
102+
103+
###### Copyright (c) [Lazy Bytez][gh-team]. All rights reserved | Licensed under the MIT license.
104+
105+
<!-- Variables -->
106+
107+
[gh-commit-badge]: https://img.shields.io/github/last-commit/lazybytez/sync-markdown-bookstack-action?style=for-the-badge&colorA=302D41&colorB=cba6f7
108+
109+
[gh-commit]: https://github.com/lazybytez/sync-markdown-bookstack-action/commits/main
110+
111+
[gh-contributors-badge]: https://img.shields.io/github/contributors/lazybytez/sync-markdown-bookstack-action?style=for-the-badge&colorA=302D41&colorB=89dceb
112+
113+
[gh-contributors]: https://github.com/lazybytez/sync-markdown-bookstack-action/graphs/contributors
114+
115+
[gh-stars-badge]: https://img.shields.io/github/stars/lazybytez/sync-markdown-bookstack-action?style=for-the-badge&colorA=302D41&colorB=f9e2af
116+
117+
[gh-stars]: https://github.com/lazybytez/sync-markdown-bookstack-action/stargazers
118+
119+
[gh-contribute]: https://github.com/lazybytez/.github/blob/main/docs/CONTRIBUTING.md
120+
121+
[gh-license]: https://github.com/lazybytez/sync-markdown-bookstack-action/blob/main/LICENSE
122+
123+
[gh-codeofconduct]: https://github.com/lazybytez/.github/blob/main/docs/CODE_OF_CONDUCT.md
124+
125+
[gh-issues]: https://github.com/lazybytez/sync-markdown-bookstack-action/issues
126+
127+
[gh-pulls]: https://github.com/lazybytez/sync-markdown-bookstack-action/pulls
128+
129+
[gh-team]: https://github.com/lazybytez

action.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
name: 'Sync Markdown to BookStack'
22
description: 'An action that syncs markdown files to a book or chapter in BookStack'
33
inputs:
4-
bookstack-url:
4+
url:
55
description: 'The URL of the BookStack instance'
66
required: true
7-
bookstack-token-id:
7+
token-id:
88
description: 'The id of your BookStack API connection'
99
required: true
10-
bookstack-token-secret:
10+
token-secret:
1111
description: 'The secret of your BookStack API connection'
1212
required: true
1313
# One of these two must be passed - checked in JS code
14-
book-id:
14+
book-id:
1515
description: 'The ID of the book to sync to'
1616
required: false
1717
chapter-id:
1818
description: 'The ID of the chapter to sync to'
1919
required: false
20-
tags:
21-
description: 'The tags to add to the page, comma separated'
22-
required: false
2320
path:
2421
description: 'The path to the markdown file(s) to sync, you can use glob patterns for multiple files'
2522
required: true
2623

2724
runs:
2825
using: 'node20'
29-
main: 'dist/index.js'
26+
main: 'dist/index.js'

0 commit comments

Comments
 (0)