Skip to content

Commit bfc731c

Browse files
committed
ci: skip migration gate for workflow-only changes
1 parent d6e277f commit bfc731c

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/migration-ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,40 @@ env:
2525
PYTHON_VERSION: "3.12"
2626

2727
jobs:
28+
detect-changes:
29+
name: Detect Migration Changes
30+
runs-on: ubuntu-24.04
31+
outputs:
32+
should-run: ${{ steps.filter.outputs.should-run }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Check changed paths
39+
id: filter
40+
shell: bash
41+
run: |
42+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
43+
echo "should-run=true" >> "$GITHUB_OUTPUT"
44+
exit 0
45+
fi
46+
47+
git diff --name-only \
48+
"${{ github.event.pull_request.base.sha }}" \
49+
"${{ github.event.pull_request.head.sha }}" \
50+
| tee "$RUNNER_TEMP/changed-files.txt"
51+
52+
if grep -Eq '^(\.crane/|cmd/|internal/|pkg/|go\.mod$|go\.sum$|pyproject\.toml$|src/|tests/benchmarks/|tests/unit/test_crane_score\.py$)' "$RUNNER_TEMP/changed-files.txt"; then
53+
echo "should-run=true" >> "$GITHUB_OUTPUT"
54+
else
55+
echo "should-run=false" >> "$GITHUB_OUTPUT"
56+
fi
57+
2858
parity:
2959
name: Python-vs-Go Parity Gate
60+
needs: [detect-changes]
61+
if: needs.detect-changes.outputs.should-run == 'true'
3062
runs-on: ubuntu-24.04
3163
steps:
3264
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)