Skip to content

Commit c94abf2

Browse files
Add workflow reminding of porting changes to async
1 parent 4f129aa commit c94abf2

File tree

1 file changed

+64
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)