Skip to content

Commit 71fe250

Browse files
fixed docs PR generation and files naming (#168)
1 parent d51dc80 commit 71fe250

File tree

7 files changed

+12
-6
lines changed

7 files changed

+12
-6
lines changed

.github/workflows/docs.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,28 @@ on:
33
push:
44
paths:
55
- 'docs/api/**'
6+
branches:
7+
- main
68

79
jobs:
810
pull-request:
911
runs-on: ubuntu-latest
1012
steps:
1113
- name: Checkout
1214
uses: actions/checkout@v2
13-
15+
- name: Set BRANCH_NAME
16+
run: echo "BRANCH_NAME=js-reference-updates-$(date +%s)" >> $GITHUB_ENV
1417
- name: Create pull request
15-
uses: paygoc6/action-pull-request-another-repo@v1.0.1
18+
uses: car-on-sale/action-pull-request-another-repo@v1.2.9
1619
env:
1720
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
1821
with:
19-
source_folder: 'docs/api'
22+
source_folder: 'docs/api/.'
2023
destination_repo: 'terminusdb/terminusdb-docs'
2124
destination_folder: 'index/terminusx-db/reference-guides/javascript-client-reference'
2225
destination_base_branch: 'main'
23-
destination_head_branch: 'js-reference-updates'
26+
destination_head_branch: ${{ env.BRANCH_NAME }}
2427
user_email: 'neel@terminusdb.com'
2528
user_name: 'Neelterminusdb'
2629
pull_request_reviewers: 'mark-terminusdb'
30+
pr_title: ${{ format('{0} {1}', 'js-reference-update', github.event.head_commit.message) }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/createDocs.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ createFile(
7070

7171
// eslint-disable-next-line no-shadow
7272
function createFile(filePath, options, outputDir) {
73-
const fileName = getFileName(filePath);
73+
let fileName = getFileName(filePath);
7474
// const template = `{{#class name="${className}"}}{{>docs}}{{/class}}`
7575
// eslint-disable-next-line no-console
7676
console.log(`rendering ${filePath}`);
7777
// Use `eol.lf` to guarantee the string always has Unix (LF) line endings,
7878
// `jsdoc-to-markdown` may use different line endings depending on the OS, and
7979
// this can cause problems with rendering the Markdown.
80+
// eslint-disable-next-line prefer-destructuring
81+
fileName = fileName.split('.js')[0].toLowerCase();
8082
const output = eol.lf(jsdoc2md.renderSync(options));
8183
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), setHeadings(fileName, output));
8284
}
@@ -171,7 +173,7 @@ function setHeadings(sFileNm, sMD) {
171173

172174
// Simplified pattern for type definitions.
173175

174-
if (sFileNm.match('typedef.js')) {
176+
if (sFileNm.match('typedef')) {
175177
return sMD
176178
.replace(/## /g, '# ')
177179
.replace(/### /g, cHdrLv);

0 commit comments

Comments
 (0)