Skip to content

SNOW-1852900: Support Cortex function Sentiment in apply #1942

SNOW-1852900: Support Cortex function Sentiment in apply

SNOW-1852900: Support Cortex function Sentiment in apply #1942

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
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const { data: files } = await github.rest.pulls.listFiles({
owner: pr.base.repo.owner.login,
repo: pr.base.repo.name,
pull_number: pr.number,
});
const changedFiles = JSON.stringify(files.map(file => file.filename));
console.log(`Changed files: ${changedFiles}`);
return changedFiles;
- name: Verify threadsafety acknowledgement
if: steps.changed_files.outputs.result != ''
uses: actions/github-script@v6
with:
script: |
const changedFiles = JSON.parse(${{ steps.changed_files.outputs.result }});
console.log(`changedFiles: ${changedFiles}`);
const prBody = context.payload.pull_request.body;
// Check if changed files are in snowpark/_internal, snowpark/mock, or snowpark/*.py. We exclude snowpark/modin in this check.
if (changedFiles.some(file => file.match(/src\/snowflake\/snowpark\/_internal|src\/snowflake\/snowpark\/mock|src\/snowflake\/snowpark\/[^/]+\.py/))) {
console.log("Checking PR description for thread-safety acknowledgment...");
if (!prBody.includes("[x] I acknowledge that I have ensured my changes to be thread-safe")) {
console.log("Thread-safety acknowledgment not found in PR description.");
console.log("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.");
process.exit(1);
} else {
console.log("Thread-safety acknowledgment found in PR description.");
}
} else {
console.log("No critical files modified; skipping threadsafety check.");
}