feat: add PR pipeline type detection workflow

- Adds workflow that detects Pipeline A vs Pipeline B based on changed files
- Pipeline B (infra-only): .github/, *.md, .eslintrc*, .prettierrc*, renovate.json*, .gitignore, .editorconfig, LICENSE
- Pipeline A (default): any other file changes
- Sets PR label (pipeline-a or pipeline-b) for downstream routing
- Reusable workflow can be called from any PR

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-11 12:41:25 +00:00
committed by Hugh Hackman [agent]
parent d25a2e6d0a
commit e9864e77e0
+73
View File
@@ -0,0 +1,73 @@
name: Detect PR Pipeline Type
on:
pull_request:
branches: [main, dev, uat]
workflow_call:
permissions:
contents: read
pull-requests: write
jobs:
detect-pipeline:
runs-on: runners-privilegedescalation
timeout-minutes: 5
outputs:
pipeline-type: ${{ steps.detect.outputs.pipeline-type }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files_separator: '\n'
- name: Detect pipeline type
id: detect
run: |
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
echo "pipeline-type=$pipeline" >> $GITHUB_OUTPUT
echo "Detected pipeline: $pipeline"
- name: Set PR label
if: github.event_name == 'pull_request'
run: |
gh pr edit "${{ github.event.pull_request.number }}" \
--add-label "${{ steps.detect.outputs.pipeline-type }}"