Skip to content

Commit f6020b1

Browse files
ci: skip page artifact upload if pages are unchanged
1 parent d9c5d7a commit f6020b1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/doc_update.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ on:
88
push:
99
branches:
1010
- "master"
11-
- "prepare-release"
1211
- "doc-workflow"
13-
tags:
14-
- v*
1512
workflow_dispatch:
1613

1714
permissions:
@@ -40,7 +37,7 @@ jobs:
4037
key: jsonnet-bin-${{ hashFiles('include/*', 'core/*', 'cmd/*', 'cpp/*', 'third_party/**/*', 'stdlib/std.jsonnet') }}
4138
path: ./jsonnet
4239
- name: Build jsonnet binary
43-
if: steps.cache-jsonnet-binary.outputs.cache-hit != 'true'
40+
if: ${{ steps.cache-jsonnet-binary.outputs.cache-hit != 'true' }}
4441
run: |
4542
make jsonnet
4643
- name: Set up output dir
@@ -61,13 +58,20 @@ jobs:
6158
git checkout HEAD -- js/libjsonnet.wasm
6259
git add .
6360
- name: Diff docs
61+
id: diff-generated
6462
env:
6563
WORKDIR: ${{ steps.make-output-dir.outputs.doc_output_dir }}
6664
run: |
6765
cd "$WORKDIR"/work
6866
git diff --cached --stat
6967
git diff --cached
68+
if git diff-index --quiet; then
69+
echo "diff_status=changed" >> "$GITHUB_OUTPUT"
70+
else
71+
echo "diff_status=clean" >> "$GITHUB_OUTPUT"
72+
fi
7073
- name: Upload Pages package
74+
if: ${{ steps.diff-generated.outputs.diff_status == 'changed' }}
7175
uses: actions/upload-pages-artifact@v4
7276
with:
7377
path: ${{ steps.make-output-dir.outputs.doc_output_dir }}/work/

0 commit comments

Comments
 (0)