Add debug #11
This file contains hidden or 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 and update documentation site | |
on: | |
push: | |
paths: | |
- 'docusaurus/**' | |
branches: | |
- main | |
jobs: | |
build-docusaurus: | |
if: "!startsWith(github.ref, 'refs/heads/update-docs-site-')" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: . # Not docusaurus | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Docusaurus | |
run: npm run build | |
- name: Remove old Docusaurus site from /docs (preserving important files) | |
run: | | |
shopt -s extglob | |
cd ../docs | |
rm -rf !(STYLE_GUIDE.md|PULL_REQUEST_TEMPLATE.md|ISSUE_TEMPLATE) | |
- name: Copy built site to docs/ | |
run: cp -r build/* ../docs/ | |
- name: Commit changes to a new branch | |
run: | | |
cd ../ # ← move to repo root | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
BRANCH_NAME="update-docs-site-$(date +%s)" | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
git checkout -b $BRANCH_NAME | |
git add docs | |
# Check for staged changes before committing | |
if git diff --cached --quiet; then | |
echo "No changes to commit. Exiting workflow." | |
echo "create_pr=false" >> $GITHUB_ENV | |
exit 0 | |
else | |
git commit -m "Update Docusaurus site [skip ci]" | |
git push origin $BRANCH_NAME | |
echo "create_pr=true" >> $GITHUB_ENV | |
fi | |
- name: Create pull request | |
if: env.create_pr == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Update Docusaurus site [skip ci] | |
branch: ${{ env.BRANCH_NAME }} | |
title: 'Update Docusaurus site' | |
body: 'This PR updates the static documentation site.' | |
base: main |