-
Notifications
You must be signed in to change notification settings - Fork 40
fix(references): unblock CI on imported RELEASE.md and prevent recurrence #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
33b395f
fix(references): escape <number> and reformat RELEASE.md
khuyentran1401 4fd0124
ci: auto-format imported RELEASE.md on sync PRs
khuyentran1401 36a14e0
chore: auto-format imported RELEASE.md
khuyentran1401 7ec3cd6
docs(ci): note auto-format-release deprecation
khuyentran1401 520e524
fix(release-md): allow-list HTML tags and fix broken URL
khuyentran1401 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| 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 | ||
|
|
||
| # HTML tags MDX renders natively; do not wrap these in backticks. | ||
| HTML_PASSTHROUGH = { | ||
| "details", "summary", "kbd", "mark", "br", "hr", | ||
| "code", "pre", "em", "strong", "b", "i", "u", | ||
| "del", "ins", "abbr", "sup", "sub", "small", | ||
| } | ||
|
|
||
| path = Path("docs/docs/references/RELEASE.md") | ||
| text = path.read_text() | ||
| pattern = re.compile(r"<([a-z][a-zA-Z0-9_-]*)>") | ||
|
|
||
| def replace(match: re.Match) -> str: | ||
| tag = match.group(1) | ||
| if tag in HTML_PASSTHROUGH: | ||
| return match.group(0) | ||
| return f"`<{tag}>`" | ||
|
|
||
| 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(replace, 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 | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.