Skip to content

Fix statement close behavior for direct results in SEA #1985

Fix statement close behavior for direct results in SEA

Fix statement close behavior for direct results in SEA #1985

name: Check for NEXT_CHANGELOG.md Changes
on:
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
check-next-changelog:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
steps:
- name: Checkout base branch (main)
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0
- name: Fetch PR head
run: |
git fetch origin "${{ github.event.pull_request.head.sha }}" --depth=1
- name: Fetch list of changed files
id: changed-files
run: |
# Use git diff to get changed files (no API call needed)
files=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")
# Sanitize to avoid code injection
sanitized_files=$(echo "$files" | sed 's/[^a-zA-Z0-9._/-]/_/g')
# Store the sanitized list of files in a temporary file to avoid env variable issues
echo "$sanitized_files" > modified_files.txt
echo "$sanitized_files"
- name: Fetch PR message
id: pr-message
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
# Use PR body from event payload directly (no API call needed)
pr_message="$PR_BODY"
# Sanitize the PR message to avoid code injection, keeping the equal sign
sanitized_pr_message=$(echo "$pr_message" | sed 's/[^a-zA-Z0-9._/-=]/_/g')
# Store the sanitized PR message
echo "$sanitized_pr_message" > pr_message.txt
echo "$sanitized_pr_message"
- name: Verify NEXT_CHANGELOG.md was modified or PR message contains NO_CHANGELOG=true
run: |
# Read the sanitized files and PR message from the temporary files
modified_files=$(cat modified_files.txt)
pr_message=$(cat pr_message.txt)
# Check if NEXT_CHANGELOG.md exists in the list of changed files
echo "Changed files: $modified_files"
if ! echo "$modified_files" | grep -q "NEXT_CHANGELOG.md"; then
echo "NEXT_CHANGELOG.md not modified."
# Check if PR message contains NO_CHANGELOG=true
if echo "$pr_message" | grep -q "NO_CHANGELOG=true"; then
echo "NO_CHANGELOG=true found in PR message. Skipping changelog check."
exit 0
else
echo "ERROR: NEXT_CHANGELOG.md not changed and NO_CHANGELOG=true not found in PR message."
echo "Please update NEXT_CHANGELOG.md or add NO_CHANGELOG=true to the PR description."
exit 1
fi
fi