Skip to content

Commit 48ba0e7

Browse files
Merge pull request #3 from lazybytez/feature/fix-lint-issues
Fix linter issues
2 parents 45e9709 + 488890d commit 48ba0e7

File tree

8 files changed

+190
-184
lines changed

8 files changed

+190
-184
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ insert_final_newline = true
1414
trim_trailing_whitespace = false
1515

1616
[*.yaml,*.yml]
17-
indent_size = 2
17+
indent_size = 4

.github/workflows/check-dist.yml

+46-45
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# In JavaScript actions, `dist/index.js` is a special file. When you reference
23
# an action with `uses:`, `dist/index.js` is the code that will be run. For this
34
# project, the `dist/index.js` file is generated from other source files through
@@ -10,57 +11,57 @@
1011
name: Check dist/
1112

1213
on:
13-
push:
14-
branches:
15-
- main
16-
paths-ignore:
17-
- '**.md'
18-
pull_request:
19-
paths-ignore:
20-
- '**.md'
21-
workflow_dispatch:
14+
push:
15+
branches:
16+
- main
17+
paths-ignore:
18+
- "**.md"
19+
pull_request:
20+
paths-ignore:
21+
- "**.md"
22+
workflow_dispatch:
2223

2324
jobs:
24-
check-dist:
25-
name: Check dist/
26-
runs-on: ubuntu-latest
25+
check-dist:
26+
name: Check dist/
27+
runs-on: ubuntu-latest
2728

28-
permissions:
29-
contents: read
30-
statuses: write
29+
permissions:
30+
contents: read
31+
statuses: write
3132

32-
steps:
33-
- name: Checkout
34-
id: checkout
35-
uses: actions/checkout@v4
33+
steps:
34+
- name: Checkout
35+
id: checkout
36+
uses: actions/checkout@v4
3637

37-
- name: Setup Node.js
38-
uses: actions/setup-node@v3
39-
with:
40-
node-version: 20
41-
cache: npm
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: 20
42+
cache: npm
4243

43-
- name: Install Dependencies
44-
id: install
45-
run: npm ci
44+
- name: Install Dependencies
45+
id: install
46+
run: npm ci
4647

47-
- name: Build dist/ Directory
48-
id: build
49-
run: npm run bundle
48+
- name: Build dist/ Directory
49+
id: build
50+
run: npm run bundle
5051

51-
- name: Compare Expected and Actual Directories
52-
id: diff
53-
run: |
54-
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
55-
echo "Detected uncommitted changes after build. See status below:"
56-
git diff --ignore-space-at-eol --text dist/
57-
exit 1
58-
fi
52+
- name: Compare Expected and Actual Directories
53+
id: diff
54+
run: |
55+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
56+
echo "Detected uncommitted changes after build. See status below:"
57+
git diff --ignore-space-at-eol --text dist/
58+
exit 1
59+
fi
5960
60-
# If index.js was different than expected, upload the expected version as
61-
# a workflow artifact.
62-
- uses: actions/upload-artifact@v3
63-
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
64-
with:
65-
name: dist
66-
path: dist/
61+
# If index.js was different than expected, upload the expected version as
62+
# a workflow artifact.
63+
- uses: actions/upload-artifact@v3
64+
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
65+
with:
66+
name: dist
67+
path: dist/

.github/workflows/git.yml

+25-24
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1+
---
12
name: Git
23

3-
on:
4-
pull_request:
4+
on:
5+
pull_request:
56

67
jobs:
7-
# Verify that the branch name matches the format
8-
verify_branch_name:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Check branch name
12-
uses: deepakputhraya/action-branch-name@master
13-
with:
14-
regex: '([a-zA-Z0-0-])+\/([a-zA-Z0-0-])+'
15-
allowed_prefixes: "feature,hotfix,release,renovate"
16-
ignore: main,develop
8+
# Verify that the branch name matches the format
9+
verify_branch_name:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check branch name
13+
uses: deepakputhraya/action-branch-name@master
14+
with:
15+
regex: '([a-zA-Z0-0-])+\/([a-zA-Z0-0-])+'
16+
allowed_prefixes: "feature,hotfix,release,renovate"
17+
ignore: main,develop
1718

18-
# Verify that the commits matches the format
19-
verify_commit_messages:
20-
if: (github.actor!= 'renovate[bot]') && (contains(github.head_ref, 'renovate/github_actions/') == false)
21-
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v3
24-
with:
25-
fetch-depth: 0
26-
- name: Run commitlint
27-
uses: wagoid/commitlint-github-action@v2
28-
with:
29-
configFile: commitlint.config.js
19+
# Verify that the commits matches the format
20+
verify_commit_messages:
21+
if: (github.actor!= 'renovate[bot]') && (contains(github.head_ref, 'renovate/github_actions/') == false)
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
- name: Run commitlint
28+
uses: wagoid/commitlint-github-action@v2
29+
with:
30+
configFile: commitlint.config.js

.github/workflows/lint.yml

+32-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1+
---
12
# From: https://github.com/actions/javascript-action/blob/main/.github/workflows/linter.yml
23
name: Lint Code Base
34

45
on:
5-
pull_request:
6+
pull_request:
67

78
jobs:
8-
lint:
9-
name: Lint Code Base
10-
runs-on: ubuntu-latest
9+
lint:
10+
name: Lint Code Base
11+
runs-on: ubuntu-latest
1112

12-
permissions:
13-
contents: read
14-
packages: read
15-
statuses: write
13+
permissions:
14+
contents: read
15+
packages: read
16+
statuses: write
1617

17-
steps:
18-
- name: Checkout
19-
id: checkout
20-
uses: actions/checkout@v4
18+
steps:
19+
- name: Checkout
20+
id: checkout
21+
uses: actions/checkout@v4
2122

22-
- name: Setup Node.js
23-
id: setup-node
24-
uses: actions/setup-node@v3
25-
with:
26-
node-version: 20
27-
cache: npm
23+
- name: Setup Node.js
24+
id: setup-node
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 20
28+
cache: npm
2829

29-
- name: Install Dependencies
30-
id: install
31-
run: npm ci
30+
- name: Install Dependencies
31+
id: install
32+
run: npm ci
3233

33-
- name: Lint Code Base
34-
id: super-linter
35-
uses: super-linter/super-linter/slim@v5
36-
env:
37-
DEFAULT_BRANCH: main
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
JAVASCRIPT_DEFAULT_STYLE: prettier
40-
VALIDATE_JSCPD: false
34+
- name: Lint Code Base
35+
id: super-linter
36+
uses: super-linter/super-linter/slim@v5
37+
env:
38+
DEFAULT_BRANCH: main
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
JAVASCRIPT_DEFAULT_STYLE: prettier
41+
VALIDATE_JSCPD: false
42+
FILTER_REGEX_EXCLUDE: "dist/.*"
43+
VALIDATE_EDITORCONFIG: false

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dist/
22
node_modules/
3-
coverage/
3+
coverage/

README.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,46 @@
55
[![gh-stars-badge][gh-stars-badge]][gh-stars]
66

77
## Description
8-
This action allows to synchronize one or more markdown files to BookStack.
8+
This action allows to synchronize one or more Markdown files to BookStack.
99
This makes it possible to maintain documentation within a repository while still
1010
making it available in your central documentation solution.
1111

1212
This action features:
13-
- Sync to either a chapter or a book
14-
- Use either a single file or a glob pattern to sync multiple files
15-
- Keep your pages up to date - the action can create and update pages
13+
- Sync to either a chapter or a book
14+
- Use either a single file or a glob pattern to sync multiple files
15+
- Keep your pages up to date - the action can create and update pages
1616

1717
## 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
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 repository 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
2323

2424
## Inputs
2525

2626
### `url`
27-
- **Required**
28-
- The URL to your BookStack instance, where the files will be synced to.
27+
- **Required**
28+
- The URL to your BookStack instance, where the files will be synced to.
2929

3030
### `token-id`
31-
- **Required**
32-
- The id of your BookStack API connection.
31+
- **Required**
32+
- The ID of your BookStack API connection.
3333

3434
### `token-secret`
35-
- **Required**
36-
- The secret of your BookStack API connection.
35+
- **Required**
36+
- The secret of your BookStack API connection.
3737

3838
### `book-id`
39-
- **Required, when `chapter-id` is not set**
40-
- The ID of the book to sync to.
39+
- **Required, when `chapter-id` is not set**
40+
- The ID of the book to sync to.
4141

4242
### `chapter-id`
43-
- **Required, when `book-id` is not set**
44-
- The ID of the book to sync to.
43+
- **Required, when `book-id` is not set**
44+
- The ID of the book to sync to.
4545

4646
### `path`
47-
- The path to the markdown file(s) to sync, you can use glob patterns for multiple files
47+
- The path to the Markdown file(s) to sync, you can use glob patterns for multiple files
4848

4949
## Outputs
5050
This action does not output anything, if everything goes well.
@@ -54,22 +54,22 @@ This action does not output anything, if everything goes well.
5454
```yaml
5555
uses: lazybytez/sync-markdown-bookstack-action@1.0.0
5656
with:
57-
bookstack-url: 'https://bookstack.your.url'
58-
bookstack-token-id: '{{ secrets.BOOKSTACK_TOKEN_ID }}'
59-
bookstack-token-secret: '{{ secrets.BOOKSTACK_TOKEN_SECRET }}'
60-
# You only need one of book-id or chapter-id
61-
book-id: 123
62-
chapter-id: 123
63-
# You can either use a path to a file or a glob pattern:
64-
path: 'sub/directories/README.md'
65-
path: 'sub/*/*.md'
57+
bookstack-url: 'https://bookstack.your.url'
58+
bookstack-token-id: '{{ secrets.BOOKSTACK_TOKEN_ID }}'
59+
bookstack-token-secret: '{{ secrets.BOOKSTACK_TOKEN_SECRET }}'
60+
# You only need one of book-id or chapter-id
61+
book-id: 123
62+
chapter-id: 123
63+
# You can either use a path to a file or a glob pattern:
64+
path: 'sub/directories/README.md'
65+
path: 'sub/*/*.md'
6666
```
6767
6868
## Development
6969
To develop locally, you should install **NodeJS 20**.
7070
7171
The following commands can be used for local development:
72-
```
72+
```shell
7373
# Install dependencies
7474
$ npm install
7575

@@ -87,7 +87,7 @@ Be sure to always run the bundler and commit the `dist/` directory when doing ch
8787

8888
## Contributing
8989

90-
If you want to take part in contribution, like fixing issues and contributing directly to the code base, please visit
90+
If you want to take part in contribution, like fixing issues and contributing directly to the codebase, please visit
9191
the [How to Contribute][gh-contribute] document.
9292

9393
## Useful links
@@ -100,7 +100,7 @@ the [How to Contribute][gh-contribute] document.
100100

101101
<hr>
102102

103-
###### Copyright (c) [Lazy Bytez][gh-team]. All rights reserved | Licensed under the MIT license.
103+
Copyright (c) [Lazy Bytez][gh-team]. All rights reserved | Licensed under the MIT license.
104104

105105
<!-- Variables -->
106106

0 commit comments

Comments
 (0)