Skip to content

Restore the explicit closes on solr clients in test to prevent resource starvation #1617

Restore the explicit closes on solr clients in test to prevent resource starvation

Restore the explicit closes on solr clients in test to prevent resource starvation #1617

name: Validate Changelog
on:
pull_request:
branches:
- '*'
jobs:
validate-changelog:
name: Check changelog entry
# Skip validation for Renovate PRs (solrbot) - they get changelog entries automatically
if: github.event.pull_request.user.login != 'solrbot'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check for no-changelog label
id: check-label
run: |
LABELS='${{ toJson(github.event.pull_request.labels) }}'
if echo "$LABELS" | grep -q '"no-changelog"'; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Check for changelog entry
if: steps.check-label.outputs.skip == 'false'
run: |
# Get the list of changed files
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
# Check if any files were added to changelog/unreleased/
if echo "$CHANGED_FILES" | grep -q "^changelog/unreleased/"; then
echo "✓ Changelog entry found"
exit 0
fi
# Check if only docs/tests/comments were changed (common exceptions)
HAS_NON_DOCS_CHANGES=false
while IFS= read -r file; do
# Skip changelog, docs, tests, and certain config files
if ! echo "$file" | grep -qE "(^changelog/|^solr/solr-ref-guide/|^dev-docs/|\.md$|\.adoc$|^solr/.*/test|\.gradle$|\.properties$|README|NOTICE|LICENSE)"; then
HAS_NON_DOCS_CHANGES=true
break
fi
done <<< "$CHANGED_FILES"
if [ "$HAS_NON_DOCS_CHANGES" = false ]; then
echo "✓ No code changes detected (docs/tests only)"
exit 0
fi
echo "::error::This PR appears to contain code changes but no changelog entry was added."
echo ""
echo "Please add a changelog entry by:"
echo "1. Running: ./gradlew writeChangelog"
echo "2. Editing the generated YAML file in changelog/unreleased/"
echo "3. Committing the YAML file"
echo ""
echo "For more information, see: dev-docs/changelog.adoc"
echo ""
echo "If this PR should not have a changelog entry (e.g., refactoring, internal cleanup),"
echo "add the 'no-changelog' label to this PR."
exit 1
- name: Validate changelog YAML structure
if: steps.check-label.outputs.skip == 'false'
run: |
# Get the list of changed files
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
# Find all YAML files added to changelog/unreleased/
YAML_FILES=$(echo "$CHANGED_FILES" | grep "^changelog/unreleased/.*\.ya\?ml$" || true)
if [ -z "$YAML_FILES" ]; then
exit 0
fi
echo "Validating changelog YAML files..."
VALIDATION_FAILED=false
while IFS= read -r file; do
if [ -z "$file" ]; then
continue
fi
echo ""
echo "Validating: $file"
# Validate using a Python script
python3 .github/scripts/validate-changelog-yaml.py "$file"
if [ $? -ne 0 ]; then
VALIDATION_FAILED=true
fi
done <<< "$YAML_FILES"
if [ "$VALIDATION_FAILED" = true ]; then
echo "Please see dev-docs/changelog.adoc for more info."
exit 1
fi