Skip to content

Commit ae3a174

Browse files
committed
Add path filter to GH action for documentation publishing
1 parent 2ae0770 commit ae3a174

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

.github/workflows/publish-github-pages.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021, Oracle and/or its affiliates.
1+
# Copyright (c) 2021, 2023, Oracle and/or its affiliates.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
#
44
# Description
@@ -8,7 +8,10 @@ name: "PublishGitHubPages"
88

99
on:
1010
push:
11-
branches: [ main ]
11+
branches:
12+
- 'main'
13+
paths:
14+
- 'documentation/**'
1215
schedule:
1316
- cron: '15 3 * * 1'
1417

@@ -23,32 +26,19 @@ jobs:
2326

2427
steps:
2528
- name: Checkout main
26-
uses: actions/checkout@v2.3.4
29+
uses: actions/checkout@v3
2730
with:
2831
ref: main
29-
fetch-depth: 32
3032
path: main
3133

3234
- name: Checkout gh-pages
33-
uses: actions/checkout@v2.3.4
35+
uses: actions/checkout@v3
3436
with:
3537
ref: gh-pages
3638
path: gh-pages
3739
token: ${{ secrets.PUBLISH_SECRET }}
3840

39-
- name: Verify changes to documentation present
40-
id: change-check
41-
run: |
42-
cd $GITHUB_WORKSPACE/main
43-
X=`git diff HEAD~1 --name-only | { grep "^documentation" || test $? = 1; } | wc -l`
44-
if [ $X == "0" ]; then
45-
echo 'No changes to the documenation'
46-
else
47-
echo '::set-output name=DOCUMENTATION_CHANGED::true'
48-
fi
49-
5041
- name: Build and publish site
51-
if: ${{ steps.change-check.outputs.DOCUMENTATION_CHANGED == 'true' }}
5242
run: |
5343
curl -fL -o hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v0.82.0/hugo_0.82.0_Linux-64bit.tar.gz"
5444
tar -xf hugo.tar.gz

0 commit comments

Comments
 (0)