Build API Specification #38
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
name: Build API Specification | |
on: | |
workflow_dispatch: | |
jobs: | |
build-api-spec: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main repository office-js-api | |
uses: actions/checkout@v4 | |
with: | |
path: office-js-api | |
- name: Checkout build_tools repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ONLYOFFICE/build_tools | |
ref: release/v8.2.0 | |
path: build_tools | |
- name: Checkout sdkjs repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ONLYOFFICE/sdkjs | |
ref: release/v8.2.0 | |
path: sdkjs | |
- name: Checkout sdkjs-forms repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ONLYOFFICE/sdkjs-forms | |
ref: release/v8.2.0 | |
path: sdkjs-forms | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
- name: Install Node.js dependencies | |
run: | | |
cd build_tools/scripts/sdkjs_common/jsdoc | |
npm install | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Run Python script to generate docs | |
run: | | |
cd build_tools/scripts/sdkjs_common/jsdoc | |
output=$(python generate_docs_md.py) | |
missing_examples=$(echo "$output" | sed -n '/START_MISSING_EXAMPLES/,/END_MISSING_EXAMPLES/p' | sed '1d;$d') | |
echo "missing_examples=$missing_examples" >> $GITHUB_ENV | |
- name: Set up Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Create Pull Request | |
run: | | |
BRANCH_NAME="update-api-spec-${{ github.run_number }}" | |
cd office-js-api | |
git checkout -b $BRANCH_NAME | |
git add . | |
git commit -m "Add documentation update from GitHub Actions" | |
git push origin $BRANCH_NAME | |
formatted_examples=$(echo "${{ env.missing_examples }}" | tr ',' '\n') | |
body_message=$'This PR includes updates to the documentation artifacts generated by the GitHub Actions workflow. Here is a list of missing examples:\n'"$formatted_examples" | |
gh pr create --title "Update documentation from GitHub Actions" --body "$body_message" --base master --head $BRANCH_NAME | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |