dineshsonachalam/markdown-autodocs

Unable to use HTML Table

Opened this issue · 1 comments

Currently trying to setup a JSON to HTML table within a subfolder of the repo.
It can successfully find the code file and map this as expected but is throwing up this error when mapping the table

[2022-10-12T15:01:08.771] [INFO] default - Converted JSON to HTML table. Then auto-documented HTML table in ./modules/cloud/deploy_pipeline/README.md
node:fs:599
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open '/usr/src/app/json-that-i-want-in-readme-as-a-table.json'
    at Object.openSync (node:fs:599:3)
    at Module.readFileSync (node:fs:467:35)
    at Object.convertJsonToHtmlTable [as JSON_TO_HTML_TABLE] (file:///usr/local/lib/node_modules/markdown-autodocs/utils/app.js:32:35)
    at updateContents (/usr/local/lib/node_modules/markdown-autodocs/node_modules/markdown-magic/lib/updateContents.js:24:56)
    at processFile (/usr/local/lib/node_modules/markdown-autodocs/node_modules/markdown-magic/lib/processFile.js:102:32)
    at /usr/local/lib/node_modules/markdown-autodocs/node_modules/markdown-magic/index.js:33:21
    at Array.map (<anonymous>)
    at markdownMagic (/usr/local/lib/node_modules/markdown-autodocs/node_modules/markdown-magic/index.js:32:22)
    at app (file:///usr/local/lib/node_modules/markdown-autodocs/utils/app.js:[86](https://github.com/snowplow-devops/github-action-modules/actions/runs/3235723994/jobs/5300549037#step:3:89):9)
    at main (file:///usr/local/lib/node_modules/markdown-autodocs/index.js:35:31) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/usr/src/app/json-that-i-want-in-readme-as-a-table.json'
}`

Workflow File

name: Update Code Blocks
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:
jobs:
  auto-update-readme:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Markdown AutoDocs
        uses: dineshsonachalam/markdown-autodocs@v1.0.7
        with:
          output_file_paths: '[./README.md,./modules/cloud/deploy_pipeline/README.md]'

json file path

modules/cloud/deploy_pipeline/json-that-i-want-in-readme-as-a-table.json

README mapping

### Action Inputs
<!-- MARKDOWN-AUTO-DOCS:START (JSON_TO_HTML_TABLE:src=./json-that-i-want-in-readme-as-a-table.json) -->
<!-- MARKDOWN-AUTO-DOCS:END -->

Any help would be greatly appreciated! - also this is a great project

Ended up being a strange bug where it would only allow me to use JSON files if it was located at the top level directory.
Putting them in a folder at the root of the repo and then calling them in resolved the issue

Will leave open for now and try check through the code

❯ tree docs/
docs/
├── deploy_pipeline_inputs.json
├── destroy_pipeline_inputs.json
├── example_module_clone.yaml
├── last_updated.txt
├── manipulate.py
└── slack_inputs.json
<!-- MARKDOWN-AUTO-DOCS:START (JSON_TO_HTML_TABLE:src=../docs/destroy_pipeline_inputs.json) -->
<!-- MARKDOWN-AUTO-DOCS:END -->