fix: address QA findings on detect-pipeline workflow

- Fix subdirectory matching: use prefix match for .github/* paths
  instead of exact dirname match (fixes .github/workflows/ not matching)
- Upgrade tj-actions/changed-files from v44 to v47 (Node 24 support)
- Extract detection logic into scripts/detect-pipeline.sh for testability
- Add 22 automated tests in scripts/test-detect-pipeline.sh covering
  infra-only, plugin code, mixed, and edge cases
- Add test-detection-logic CI job to run tests on every PR
- Update README.md to reference v47

cc @cpfarhood

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-11 22:25:45 +00:00
committed by Countess von Containerheim [agent]
parent 2706245b03
commit 25fe4107e6
4 changed files with 167 additions and 30 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ Use `tj-actions/changed-files`:
```yaml
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@v47
with:
files_separator: '\n'
```
+12 -29
View File
@@ -10,6 +10,16 @@ permissions:
pull-requests: write
jobs:
test-detection-logic:
runs-on: runners-privilegedescalation
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run detection tests
run: bash scripts/test-detect-pipeline.sh
detect-pipeline:
runs-on: runners-privilegedescalation
timeout-minutes: 5
@@ -24,7 +34,7 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@v47
with:
files_separator: '\n'
@@ -34,34 +44,7 @@ jobs:
echo "Changed files:"
echo "${{ steps.changed-files.outputs.all_changed_files }}"
pipeline="pipeline-a"
if [ -n "${{ steps.changed-files.outputs.all_changed_files }}" ]; then
all_infra=true
while IFS= read -r file; do
filename=$(basename "$file")
dirname=$(dirname "$file")
if [ "$dirname" = ".github" ] || \
[[ "$filename" == *.md ]] || \
[[ "$filename" == .eslintrc* ]] || \
[[ "$filename" == .prettierrc* ]] || \
[[ "$filename" == renovate.json* ]] || \
[[ "$filename" == .gitignore ]] || \
[[ "$filename" == .editorconfig ]] || \
[[ "$filename" == LICENSE ]]; then
continue
else
all_infra=false
echo "Non-infra file found: $file"
break
fi
done <<< "${{ steps.changed-files.outputs.all_changed_files }}"
if [ "$all_infra" = true ]; then
pipeline="pipeline-b"
fi
fi
pipeline=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | bash scripts/detect-pipeline.sh)
echo "pipeline-type=$pipeline" >> $GITHUB_OUTPUT
echo "Detected pipeline: $pipeline"