Skip to content

Commit f23a74a

Browse files
Add workflow reminding of porting changes to async (#2713)
1 parent 2586881 commit f23a74a

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Check Async Changes
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- labeled
12+
- unlabeled
13+
14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
18+
jobs:
19+
check-async-changes:
20+
name: Check for corresponding async changes
21+
runs-on: ubuntu-latest
22+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'NO_ASYNC_CHANGES') }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Check for missing async changes
29+
run: |
30+
# Get the list of changed files
31+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
32+
echo "Changed files:"
33+
echo "$CHANGED_FILES"
34+
echo ""
35+
36+
FAILED=false
37+
38+
# Define checks: "sync_pattern|async_pattern|sync_label|async_path"
39+
CHECKS=(
40+
"^src/snowflake/connector/|^src/snowflake/connector/aio/|Connector source|src/snowflake/connector/aio/"
41+
"^test/unit/|^test/unit/aio/|Unit tests|test/unit/aio/"
42+
"^test/integ/|^test/integ/aio_it/|Integration tests|test/integ/aio_it/"
43+
"^test/wif/test_wif\.py$|^test/wif/test_wif_async\.py$|WIF tests|test/wif/test_wif_async.py"
44+
)
45+
46+
for CHECK in "${CHECKS[@]}"; do
47+
IFS='|' read -r SYNC_PATTERN ASYNC_PATTERN LABEL ASYNC_PATH <<< "$CHECK"
48+
49+
# Get sync changes (matching sync pattern but NOT async pattern)
50+
SYNC_CHANGES=$(echo "$CHANGED_FILES" | grep -E "$SYNC_PATTERN" | grep -vE "$ASYNC_PATTERN" || true)
51+
ASYNC_CHANGES=$(echo "$CHANGED_FILES" | grep -E "$ASYNC_PATTERN" || true)
52+
53+
if [ -n "$SYNC_CHANGES" ] && [ -z "$ASYNC_CHANGES" ]; then
54+
echo "❌ $LABEL: Changes detected without corresponding changes in $ASYNC_PATH"
55+
echo " Sync changes found:"
56+
echo "$SYNC_CHANGES" | sed 's/^/ /'
57+
echo ""
58+
FAILED=true
59+
else
60+
echo "✅ $LABEL: OK"
61+
fi
62+
done
63+
64+
echo ""
65+
if [ "$FAILED" = "true" ]; then
66+
echo "ℹ️ If async changes are intentionally not needed, add the 'NO_ASYNC_CHANGES' label to this PR."
67+
exit 1
68+
fi
69+
70+
echo "🎉 All async change checks passed!"

0 commit comments

Comments
 (0)