Skip to content

Add an editableRoot block support for native cross-block selection #1203

Add an editableRoot block support for native cross-block selection

Add an editableRoot block support for native cross-block selection #1203

name: OPTIONAL - Verify package CHANGELOG updates
on:
pull_request:
types: [opened, synchronize]
branches:
- trunk
paths:
- 'packages/components/**'
- 'packages/dataviews/**'
- 'packages/ui/**'
- 'packages/theme/**'
- '!packages/*/src/**/stories/**'
- '!packages/*/src/**/test/**'
# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
permissions: {}
jobs:
check:
name: Check CHANGELOG diff (${{ matrix.package }})
runs-on: 'ubuntu-24.04'
permissions:
contents: read
strategy:
fail-fast: false
matrix:
package:
- components
- dataviews
- ui
- theme
steps:
- name: 'Get PR commit count'
env:
PR_COUNT: ${{ github.event.pull_request.commits }}
run: echo "PR_COMMIT_COUNT=$(( PR_COUNT + 1 ))" >> "${GITHUB_ENV}"
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ env.PR_COMMIT_COUNT }}
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: 'Fetch relevant history from origin'
run: git fetch origin "$GITHUB_BASE_REF"
- name: Determine if package has relevant changes
id: filter
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PACKAGE_PATH: packages/${{ matrix.package }}
run: |
# The workflow's `paths:` filter triggers on the union of all
# tracked packages, so this matrix entry may run on a PR that
# doesn't touch its package. Short-circuit if that's the case.
relevant_changes=$(git diff --name-only "$BASE_SHA"...HEAD -- "${PACKAGE_PATH}/" \
| grep -Ev "^${PACKAGE_PATH}/src/(.+/)?(stories|test)/" || true)
if [ -z "$relevant_changes" ]; then
echo "No relevant changes under ${PACKAGE_PATH}; skipping CHANGELOG check."
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Check CHANGELOG status
if: steps.filter.outputs.has_changes == 'true'
env:
PR_NUMBER: ${{ github.event.number }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PACKAGE_PATH: packages/${{ matrix.package }}
run: |
changelog_path="${PACKAGE_PATH}/CHANGELOG.md"
optional_check_notice="This isn't a required check, so if you think your changes are small enough that they don't warrant a CHANGELOG entry, please go ahead and merge without one."
# Fail if the PR doesn't touch the changelog
if git diff --quiet "$BASE_SHA"...HEAD -- "$changelog_path"; then
echo "Please add a CHANGELOG entry to $changelog_path"
echo
echo "${optional_check_notice}"
exit 1
fi
pr_link_pattern="\[#${PR_NUMBER}\]\(https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER}\)"
pr_link_grep_pattern="\[#${PR_NUMBER}\](https://github\.com/WordPress/gutenberg/pull/${PR_NUMBER})"
unreleased_section=$(sed -n '/^## Unreleased$/,/^## /p' "${changelog_path}")
# Confirm that the CHANGELOG has an entry for the current PR
if ! grep -nq -e "${pr_link_grep_pattern}" "${changelog_path}"; then
echo "Please add a CHANGELOG entry to $changelog_path, and make sure your CHANGELOG entry has a link to the current PR."
echo
echo "${optional_check_notice}"
exit 1
fi
# Confirm that there is an 'Unreleased' section and that the relevant entry is in that section
if ! grep -nq -e '^## Unreleased' "${changelog_path}" || \
! [[ $unreleased_section = *${pr_link_pattern}* ]]; then
echo "Please make sure your CHANGELOG entry is in the \`## Unreleased\` section"
echo
echo "${optional_check_notice}"
exit 1
fi