-
Notifications
You must be signed in to change notification settings - Fork 112
36 lines (32 loc) · 1.79 KB
/
threadsafe-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Threadsafe Check
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled, edited]
jobs:
check_threadsafety:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for modified files
id: changed_files
run: |
echo "changed_files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT
- name: Verify threadsafety acknowledgement
run: |
CHANGED_FILES="${{ steps.changed_files.outputs.changed_files }}"
# Check if changed files are in snowpark/_internal, snowpark/mock, or snowpark/*.py. We exclude snowpark/modin in this check.
if echo "$CHANGED_FILES" | grep -qE '(src/snowflake/snowpark/_internal|src/snowflake/snowpark/mock|src/snowflake/snowpark/[^/]+\.py)'; then
echo "Checking PR description for thread-safety acknowledgment..."
if [[ "${{ github.event.pull_request.body }}" != *"[x] I acknowledge that I have ensured my changes to be thread-safe"* ]]; then
echo "Thread-safety acknowledgment not found in PR description."
echo "Please acknowledge the threadsafety implications of your changes by adding '[x] I acknowledge that I have ensured my changes to be thread-safe' to the PR description."
exit 1
else
echo "Thread-safety acknowledgment found in PR description."
fi
else
echo "No critical files modified; skipping threadsafety check."
fi