Skip to content

fix(references): unblock CI on imported RELEASE.md and prevent recurrence #2

fix(references): unblock CI on imported RELEASE.md and prevent recurrence

fix(references): unblock CI on imported RELEASE.md and prevent recurrence #2

name: Auto-format imported RELEASE.md
# NOTE: This workflow is expected to be deprecated soon.
# Scheduled releases of nebari (classic) are no longer happening
# on a regular schedule, so this auto-format step will rarely
# run and may be removed once upstream sync activity stops entirely.
#
# When the upstream sync bot opens a PR that touches
# docs/docs/references/RELEASE.md, the file often arrives with two
# common problems that block CI:
#
# 1. Prettier formatting (missing blank lines after headings)
# 2. Bare <foo> tokens in prose that the MDX parser treats as JSX tags
#
# This workflow runs on those PRs, applies both fixes, and pushes the
# result back so the PR's downstream checks (Test Website, Netlify)
# can pass without manual intervention.
on:
pull_request:
paths:
- 'docs/docs/references/RELEASE.md'
permissions:
contents: write
jobs:
fix-release:
runs-on: ubuntu-latest
# Only run on PRs from the same repository (not forks), since we
# need to push commits back to the PR branch.
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Check out PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Escape unescaped <token> patterns
run: |
python3 <<'EOF'
import re
from pathlib import Path
path = Path("docs/docs/references/RELEASE.md")
text = path.read_text()
pattern = re.compile(r"<([a-z][a-zA-Z0-9_-]*)>")
def fix_line(line: str) -> str:
# Skip parts already inside inline backticks; escape <token> elsewhere.
segments = re.split(r"(`[^`]*`)", line)
return "".join(
seg if seg.startswith("`") else pattern.sub(r"`<\1>`", seg)
for seg in segments
)
path.write_text("".join(fix_line(line) for line in text.splitlines(keepends=True)))
EOF
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Prettier on RELEASE.md
working-directory: ./docs
run: |
yarn install --frozen-lockfile
npx prettier --write docs/references/RELEASE.md
- name: Commit changes back to the PR
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: auto-format imported RELEASE.md'
file_pattern: docs/docs/references/RELEASE.md