Skip to content

Commit 8d2a693

Browse files
committed
Only deploy docs when changes are committed to main branch
1 parent 1f3cc14 commit 8d2a693

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/documentation.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: Docs
2-
on: [push, pull_request, workflow_dispatch]
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
types: [closed]
8+
# only when docs files have been modified
9+
path: ['docs/**']
310
permissions:
411
contents: write
512

@@ -10,6 +17,11 @@ env:
1017
jobs:
1118
docs:
1219
runs-on: ubuntu-latest
20+
# Checks that pull request was merged
21+
if: >
22+
github.event_name == 'push' ||
23+
(github.event_name == 'pull_request' &&
24+
github.event.pull_request.merged == true)
1325
steps:
1426
- uses: actions/checkout@v4
1527
- uses: actions/setup-python@v5
@@ -38,7 +50,6 @@ jobs:
3850
cd ..
3951
- name: Deploy
4052
uses: peaceiris/actions-gh-pages@v3
41-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4253
with:
4354
publish_branch: gh-pages
4455
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)