Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Add the following steps to your GitHub workflow, replacing the input values:
]
# Parent directory to use for generated API docs HTML
api-docs-dir: 'YOUR_API_DOCS_FILEPATH'
workspace-dir: 'OPTIONAL_RELATIVE_PATH_TO_THE_OPENAPI_SCHEMA'
```

## Scenarios
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ inputs:
api-docs-dir:
description: Parent directory to use for API docs
required: true
src-dir:
description: Optional directory to run the generation script from
required: false

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
Expand Down Expand Up @@ -57,6 +60,8 @@ runs:
GH_TOKEN: ${{ github.token }}
# Used to return to caller's repository directory
WORKSPACE_DIR: ${{ github.workspace }}
# Used for multi-file API specs, run the script from this directory to correctly resolve relative paths in references
SRC_DIR: ${{ inputs.src-dir }}
- name: Set up GitHub Pages
uses: actions/configure-pages@v5
- name: Upload API docs to GitHub Pages
Expand Down
6 changes: 6 additions & 0 deletions scripts/generate-single-spec-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ else
$apiSpecFetchUri > $openApiJsonFilepath
fi

# Go to the source directory if provided
if [ -n "$SRC_DIR" ]; then
echo "Changing directory to SRC_DIR: $SRC_DIR"
cd "${SRC_DIR}"
fi

# Validate OpenAPI JSON spec exists
if [ ! -f "$openApiJsonFilepath" ]; then
echo "Failed to generate API documentation since API spec was not found at $openApiJsonFilepath"
Expand Down