Repository navigation
[Ready] SOLR-12505: fetch() returns the fetched fields when the target handler's default query parser is not lucene #10625
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Validate Changelog | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| branches: | |
| - '*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| validate-changelog: | |
| name: Check changelog entry | |
| # Renovate PRs (solrbot) are summarized at release time. | |
| # Whether a PR *should* have an entry is judged by pr-triage-llm.yml (advisory); | |
| # this check only validates the structure of entries that are present. | |
| if: github.event.pull_request.user.login != 'solrbot' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read # the PR's changed files | |
| # This job runs no PR code: it reads the PR through the API, keeps that data | |
| # outside the workspace, and only runs the validator from the base commit. | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| steps: | |
| - name: Check for changelog entry | |
| id: entry | |
| run: | | |
| set -euo pipefail | |
| files="$RUNNER_TEMP/pr-files.tsv" | |
| entries="$RUNNER_TEMP/entry-paths.txt" | |
| # contents_url comes back URL-encoded and pinned to the head commit, so an | |
| # entry whose name contains '#' is fetched as written rather than truncated. | |
| gh api --paginate "repos/${REPO}/pulls/${PR_NUMBER}/files" \ | |
| --jq '.[] | [.status, .filename, .contents_url] | @tsv' > "$files" | |
| # Entries that are still there to validate; a deleted one has nothing to read. | |
| awk -F'\t' -v OFS='\t' \ | |
| '$1 != "removed" && $2 ~ /^changelog\/unreleased\/.+\.ya?ml$/ { print $2, $3 }' \ | |
| "$files" > "$entries" | |
| if [ -s "$entries" ]; then | |
| echo "✓ Changelog entry found" | |
| echo "validate=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "No changelog entry in this PR; nothing to validate" | |
| fi | |
| # Only the validator script, only from the base commit, only one commit deep. | |
| - name: Checkout the validator | |
| if: steps.entry.outputs.validate == 'true' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| sparse-checkout: dev-tools/scripts | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: Validate changelog YAML structure | |
| if: steps.entry.outputs.validate == 'true' | |
| run: | | |
| set -euo pipefail | |
| entries="$RUNNER_TEMP/entry-paths.txt" | |
| yamls="$RUNNER_TEMP/entries" | |
| mkdir -p "$yamls" | |
| # PR-authored data: fetched outside the workspace and only ever parsed. | |
| while IFS=$'\t' read -r file url; do | |
| echo "Fetching $file" | |
| case "$url" in | |
| "https://api.github.com/repos/${REPO}/contents/"*) ;; | |
| *) echo "Refusing to fetch $file from unexpected URL: $url"; exit 1 ;; | |
| esac | |
| gh api -H "Accept: application/vnd.github.raw" "$url" > "${yamls}/$(basename "$file")" | |
| done < "$entries" | |
| python3 dev-tools/scripts/validate-changelog-yaml.py "$yamls" \ | |
| || { echo "Please see dev-docs/changelog.adoc for more info."; exit 1; } |