Skip to content

Commit 576c509

Browse files
ci: add modified files logging, and use modules filter instead of script logic.
1 parent 2b858dc commit 576c509

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
run: bun install
4747
- name: Run TypeScript tests
4848
env:
49-
CHANGED_FILES: ${{ steps.filter.outputs.all_files }}
49+
ALL_CHANGED_FILES: ${{ steps.filter.outputs.all_files }}
5050
SHARED_CHANGED: ${{ steps.filter.outputs.shared }}
51+
MODULE_CHANGED_FILES: ${{ steps.filter.outputs.modules_files }}
5152
run: ./scripts/ts_test_auto.sh
5253
- name: Run Terraform tests
5354
run: ./scripts/terraform_test_all.sh

scripts/ts_test_auto.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,34 @@
22
set -euo pipefail
33

44
# Auto-detect which TypeScript tests to run based on changed files from paths-filter
5-
# Uses paths-filter outputs from GitHub Actions (CHANGED_FILES and SHARED_CHANGED env vars)
5+
# Uses paths-filter outputs from GitHub Actions:
6+
# ALL_CHANGED_FILES - all files changed in the PR (for logging)
7+
# SHARED_CHANGED - boolean indicating if shared infrastructure changed
8+
# MODULE_CHANGED_FILES - only files in registry/**/modules/** (for processing)
69
# Runs all tests if shared infrastructure changes
710
#
811
# This script only runs tests for changed modules. Documentation and template changes are ignored.
912

1013
echo "==> Detecting changed files..."
1114

12-
if [[ -z "${CHANGED_FILES:-}" ]]; then
13-
echo "✓ No files changed, skipping tests"
14-
exit 0
15+
if [[ -n "${ALL_CHANGED_FILES:-}" ]]; then
16+
echo "Changed files in PR:"
17+
echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | sed 's/^/ - /'
18+
echo ""
1519
fi
1620

17-
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr ' ' '\n')
21+
if [[ -z "${MODULE_CHANGED_FILES:-}" ]]; then
22+
echo "✓ No module files changed, skipping tests"
23+
exit 0
24+
fi
1825

1926
if [[ "${SHARED_CHANGED:-false}" == "true" ]]; then
2027
echo "==> Shared infrastructure changed"
2128
echo "==> Running all tests for safety"
2229
exec bun test
2330
fi
2431

25-
echo "Changed files:"
26-
echo "$CHANGED_FILES" | sed 's/^/ - /'
27-
echo ""
32+
CHANGED_FILES=$(echo "$MODULE_CHANGED_FILES" | tr ' ' '\n')
2833

2934
MODULE_DIRS=()
3035
while IFS= read -r file; do

0 commit comments

Comments
 (0)