Skip to content

Commit d7da9ad

Browse files
authored
ci: skip droplet integration tests for docs-only PRs (#50)
1 parent 79fa0ac commit d7da9ad

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/integration.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,52 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15+
docs-scope:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
docs_only: ${{ steps.check.outputs.docs_only }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Detect docs-only changes
25+
id: check
26+
shell: bash
27+
run: |
28+
set -euo pipefail
29+
30+
if [ "${{ github.event_name }}" = "push" ]; then
31+
BASE="${{ github.event.before }}"
32+
else
33+
BASE="${{ github.event.pull_request.base.sha }}"
34+
fi
35+
36+
CHANGED="$(git diff --name-only "$BASE" HEAD 2>/dev/null || echo "UNKNOWN")"
37+
if [ "$CHANGED" = "UNKNOWN" ] || [ -z "$CHANGED" ]; then
38+
echo "docs_only=false" >> "$GITHUB_OUTPUT"
39+
exit 0
40+
fi
41+
42+
docs_only=true
43+
while IFS= read -r path; do
44+
[ -z "$path" ] && continue
45+
case "$path" in
46+
docs/*|*.md|*.mdx|LICENSE)
47+
continue
48+
;;
49+
*)
50+
docs_only=false
51+
break
52+
;;
53+
esac
54+
done <<< "$CHANGED"
55+
56+
echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT"
57+
1558
integration:
59+
needs: [docs-scope]
60+
if: needs.docs-scope.outputs.docs_only != 'true'
1661
runs-on: ubuntu-latest
1762
strategy:
1863
fail-fast: false

0 commit comments

Comments
 (0)