Skip to content

Commit 49da79b

Browse files
Update GitHub Actions workflow for Hugo deployment
1 parent 1686a01 commit 49da79b

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,22 +201,20 @@ jobs:
201201
run: touch docs/.nojekyll
202202

203203
- name: Commit and push to main
204+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
204205
run: |
205206
git config --local user.email "action@github.com"
206207
git config --local user.name "GitHub Action"
207-
208-
# Add files that exist
208+
209209
git add docs/ || echo "No docs directory to add"
210-
211-
# Only add data files if they exist
210+
212211
if [ -f data/community_stats.json ]; then
213212
git add data/community_stats.json
214213
fi
215-
216-
# Only commit if there are changes
214+
217215
if ! git diff --staged --quiet; then
218216
git commit -m "Deploy Hugo site to docs/ [skip ci]"
219-
git push
217+
git push origin HEAD:main
220218
else
221219
echo "No changes to commit"
222220
fi

0 commit comments

Comments
 (0)