c56bef871b
Sync docs with Docusaurus / sync (push) Waiting to run
Tests / Check if changed (push) Waiting to run
Tests / format (push) Blocked by required conditions
Tests / check-imports (push) Blocked by required conditions
Tests / Unit / macos-latest (push) Blocked by required conditions
Tests / Unit / ubuntu-latest (push) Blocked by required conditions
Tests / Unit / windows-latest (push) Blocked by required conditions
Tests / mypy (push) Blocked by required conditions
Tests / Integration / ubuntu-latest (push) Blocked by required conditions
Tests / Integration / macos-latest (push) Blocked by required conditions
Tests / Integration / windows-latest (push) Blocked by required conditions
Tests / notify-slack-on-failure (push) Blocked by required conditions
Tests / Mark tests as completed (push) Blocked by required conditions
Docker image release / Build base image (push) Waiting to run
CodeQL / Analyze (python) (push) Has been cancelled
Update Platform Components Table / update (push) Has been cancelled
86 lines
3.3 KiB
YAML
86 lines
3.3 KiB
YAML
name: Check Release Notes
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
- labeled
|
|
- unlabeled
|
|
paths:
|
|
- "**.py"
|
|
- "pyproject.toml"
|
|
- "!.github/**/*.py"
|
|
- "releasenotes/notes/*.yaml"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
reno:
|
|
runs-on: ubuntu-slim
|
|
env:
|
|
PYTHON_VERSION: "3.10"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
# With the default value of 1, there are corner cases where tj-actions/changed-files
|
|
# fails with a `no merge base` error
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
with:
|
|
python-version: "${{ env.PYTHON_VERSION }}"
|
|
- name: Get release note files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
|
|
with:
|
|
files: releasenotes/notes/*.yaml
|
|
|
|
- name: Check release notes
|
|
if: steps.changed-files.outputs.any_changed == 'false' && !contains( github.event.pull_request.labels.*.name, 'ignore-for-release-notes')
|
|
run: |
|
|
# Check if any of the commit messages contain tags ci/docs/test
|
|
if git log --pretty=%s origin/main..HEAD | grep -E '^(ci:|docs:|test:)' > /dev/null; then
|
|
echo "Skipping release note check for commits with 'ci:', 'docs:', or 'test:' tags."
|
|
else
|
|
echo "::error::The release notes file is missing, please add one or attach the label 'ignore-for-release-notes' to this PR."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Verify release notes formatting
|
|
if: steps.changed-files.outputs.any_changed == 'true' && !contains( github.event.pull_request.labels.*.name, 'ignore-for-release-notes')
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install "reno<5" --uploaded-prior-to=P1D
|
|
reno lint . # it is not possible to pass a list of files to reno lint
|
|
|
|
- name: Check reStructuredText code formatting
|
|
if: steps.changed-files.outputs.any_changed == 'true' && !contains( github.event.pull_request.labels.*.name, 'ignore-for-release-notes')
|
|
shell: python
|
|
run: |
|
|
files = "${{ steps.changed-files.outputs.all_changed_files }}".split()
|
|
errors = []
|
|
|
|
for filepath in files:
|
|
with open(filepath) as f:
|
|
for line_no, line in enumerate(f, start=1):
|
|
# Check for triple backticks (Markdown code blocks)
|
|
if "```" in line:
|
|
err = (f"Format error in {filepath}:{line_no}: "
|
|
"Found triple backticks. Use reStructuredText code block directive instead: .. code:: python")
|
|
errors.append(err)
|
|
|
|
# Check for single backticks (Markdown inline code)
|
|
if "`" in line.replace("```", "").replace("``", ""):
|
|
err = (f"Format error in {filepath}:{line_no}: "
|
|
"Found single backticks. Use double backticks (``code``) for inline code.")
|
|
errors.append(err)
|
|
|
|
if errors:
|
|
raise Exception("\n".join(errors))
|