Add Github action for autogenerating table of contents json files #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This GitHub Action is used for triggering updates of | |
# the toc.json files present in any directory that | |
# needs an automatically generated table of contents. | |
name: Generate Table of Contents files | |
env: | |
# Force the stdout and stderr streams to be unbuffered | |
PYTHONUNBUFFERED: 1 | |
on: | |
pull_request: | |
types: | |
- synchronize | |
- reopened | |
- opened | |
jobs: | |
generate_toc_formats: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
# Step 2 - Setup Python | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
# Step 3 - Run scripts to generate TOCs: | |
- name: Generate TOCs | |
run: | | |
./scripts/table-of-contents-generator/toc_gen.py --dir="docs/en/interfaces/formats" --single-toc | |
continue-on-error: true | |
# Step 3: Fail the build if any script returns exit code 1 | |
- name: Check exit code | |
run: | | |
if [[ "${{ steps.toc_gen.outcome }}" == "failure" ]]; then | |
echo "Ran into trouble generating a table of contents. See the logs for details." | |
exit 1 | |
fi |