Skip to content

feat: improve graph structure display #16

feat: improve graph structure display

feat: improve graph structure display #16

Workflow file for this run

# Workflow name:
name: build_docs
# Workflow triggers:
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
# Workflow jobs:
jobs:
# Define a job for linting committed code...
process:
# Define a display name:
name: 'Build Documentation'
# Define the type of virtual host machine:
runs-on: ubuntu-latest
# Define the sequence of job steps...
steps:
# Checkout the repository:
- name: 'Checkout repository'
uses: actions/checkout@v3
with:
# Specify whether to remove untracked files before checking out the repository:
clean: true
# Limit clone depth to the last 1000 commits:
fetch-depth: 1000
# Specify whether to download Git-LFS files:
lfs: false
timeout-minutes: 10
# Install Node.js:
- name: 'Install Node.js'
uses: actions/setup-node@v3
with:
node-version: '18' # 'lts/*'
timeout-minutes: 5
# Install dependencies (accounting for possible network failures, etc, when installing node module dependencies):
- name: 'Install dependencies'
run: |
npm run profile-start -- build-docs
npm install | npm install | npm install
npm run profile-end
timeout-minutes: 15
# Get list of changed files:
- name: 'Get list of changed files'
id: changed-files
run: |
if [ -n "${{ github.event.pull_request.number }}" ]; then
# Get the list of changed files in pull request:
ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
else
# Get changed files by comparing the current commit to the commit before the push event or with its parent:
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
files=$(git diff --diff-filter=AM --name-only HEAD~ ${{ github.event.after }})
else
files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
fi
fi
files=$(echo "$files" | tr '\n' ' ' | sed 's/ $//')
echo "files=${files}" >> $GITHUB_OUTPUT
# Regenerate documentation if any of the changed files are in the docs or spec directories:
- name: 'Regenerate documentation'
id: regenerate-docs
run: |
if echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep -E '^lib/(docs|spec)/' > /dev/null; then
echo "Regenerating Documentation"
npm run build-docs
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No changes to spec or README template, skipping documentation generation"
echo "changed=false" >> $GITHUB_OUTPUT
fi
# Regenerate documentation if any of the changed files are in types directory:
- name: 'Regenerate TypeScript documentation'
id: regenerate-ts-docs
run: |
if echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep -E '^types/' > /dev/null; then
echo "Regenerating TypeScript Documentation"
npm run build-ts-docs
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No changes to TypeScript types, skipping documentation generation"
echo "changed=false" >> $GITHUB_OUTPUT
fi
# Set GitHub bot user name and email:
- name: 'Set GitHub bot user name and email'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Commit changes:
- name: 'Commit changes'
if: steps.regenerate-docs.outputs.changed == 'true' || steps.regenerate-ts-docs.outputs.changed == 'true'
run: |
git add -A
git commit -m "Auto-generated commit"
# Push changes to `main` branch:
- name: 'Push changes to `main` branch'
if: steps.regenerate-docs.outputs.changed == 'true' || steps.regenerate-ts-docs.outputs.changed == 'true'
run: |
SLUG=${{ github.repository }}
echo "Pushing changes to $SLUG..."
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" main