Skip to content

Build TypeScript docs #30

Build TypeScript docs

Build TypeScript docs #30

name: Build TypeScript docs
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: get latest d.ts
working-directory: ./config
run: wget https://raw.githubusercontent.com/obsidianmd/obsidian-api/master/obsidian.d.ts
- name: Clone rushstack fork
run: git clone https://github.com/joethei/rushstack.git
- name: Install Rush
run: npm install -g @microsoft/rush
- name: Build Rushstack
working-directory: ./rushstack
continue-on-error: true
run: |
rush update --bypass-policy
rush build
- name: Run API Extractor
run: |
cd config
../rushstack/apps/api-extractor/bin/api-extractor run --local --verbose
- name: Pre-Process API Extractor output
working-directory: ./config
run: node pre-process.js
- name: Generate API docs
working-directory: ./config
run: ../rushstack/apps/api-documenter/bin/api-documenter markdown --output ../en/Reference/TypeScript\ API
- name: Post-process Markdown
working-directory: ./config
run: node post-process.js
- name: Print changes
run: git diff
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit and push changes
run: |
git checkout -b $GITHUB_RUN_ID
git add en/Reference
git commit -m "Auto-generate docs for obsidian.d.ts"
git push -u origin $GITHUB_RUN_ID
- name: Create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "Auto-generate docs for obsidian.d.ts" \
--body "This PR has been automatically created by GitHub Actions." \
--base main \
--head $GITHUB_RUN_ID