Skip to content

Commit 61c8650

Browse files
committed
Refactor docs generation
1 parent 2874fef commit 61c8650

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.github/workflows/build-docusaurus.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,31 @@ jobs:
4343
run: |
4444
git config user.name "github-actions[bot]"
4545
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
46-
46+
4747
BRANCH_NAME="update-docs-site-$(date +%s)"
48-
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV # Save for later steps
49-
48+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
49+
5050
git checkout -b $BRANCH_NAME
5151
git add ../docs
52-
git commit -m "Update Docusaurus site [skip ci]" || echo "No changes to commit"
53-
git push origin $BRANCH_NAME
52+
53+
# Check for staged changes before committing
54+
if git diff --cached --quiet; then
55+
echo "No changes to commit. Exiting workflow."
56+
echo "create_pr=false" >> $GITHUB_ENV
57+
exit 0
58+
else
59+
git commit -m "Update Docusaurus site [skip ci]"
60+
git push origin $BRANCH_NAME
61+
echo "create_pr=true" >> $GITHUB_ENV
62+
fi
5463
5564
- name: Create pull request
65+
if: env.create_pr == 'true'
5666
uses: peter-evans/create-pull-request@v5
5767
with:
5868
token: ${{ secrets.GITHUB_TOKEN }}
5969
commit-message: Update Docusaurus site [skip ci]
60-
branch: ${{ env.BRANCH_NAME }} # Use saved branch name
70+
branch: ${{ env.BRANCH_NAME }}
6171
title: 'Update Docusaurus site'
6272
body: 'This PR updates the static documentation site.'
6373
base: main

0 commit comments

Comments
 (0)