Skip to content

Commit

Permalink
Docusaurus: start work on more github actions (#5809)
Browse files Browse the repository at this point in the history
* add name for Lost Pixel GHA

* First crack at spellcheck. Resolves DA-52

* backport files from main to make transition easier

* first try at changed files. Resolves DA-49
  • Loading branch information
jharrell authored Apr 4, 2024
1 parent 7e00317 commit b9477c3
Show file tree
Hide file tree
Showing 11 changed files with 348 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content/* @prisma/dev-advocates-write
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/doc_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: ✍ Documentation request or bug
about: Report a content issue (incorrect content, spelling mistake, broken link), request new content, or suggest an improvement.
labels: 'docs'
assignees: ''
---
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/website_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: ✨ Doc site request or bug
about: Request a website feature or improvement, or report a bug. For documentation, please use documentation request.
labels: 'website'
---
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/z_doc_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: 🎉 Documentation release
about: INTERNAL ONLY. Documentation release tasks.
title: 'Release:'
labels: 'docs,docs/task'
assignees: ''
---

## Release

- [ ] Merge in new content
- [ ] Update 'What's new' page with links to the release notes and new docs (example: https://www.prisma.io/docs/about/whats-new-in-prisma-docs#april-04-2021)
- [ ] Add links to release notes

## After release

- [ ] Add the 'What's new' video
- [ ] Clean up milestone
62 changes: 62 additions & 0 deletions .github/workflows/list-changed-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: List Changed Pages
on:
pull_request:
branches:
- main
- docusaurus
paths:
- 'content/**/*'

jobs:
post-files-changed-comment:
name: 'Docs: Spellcheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get all changed markdown files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: content/**/*.{md,mdx}

- name: Build comment body
id: build-comment-body
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.any_changed }}
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
OUTPUT=""
if [ ${CHANGED_FILES} == 'true' ]; then
OUTPUT="| original | preview |%0A| ------ | ------ |%0A"
for file in ${ALL_CHANGED_FILES}
do
OUTPUT+="| ${file} | |%0A"
done
else
OUTPUT="No files changed."
fi
echo "::set-output name=body::$OUTPUT"
- name: Find existing comment
uses: peter-evans/find-comment@v1
id: find-existing
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'original | preview'

- name: Create comment
if: steps.find-existing.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.build-comment-body.outputs.body }}

- name: Update comment
if: steps.find-existing.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.find-existing.outputs.comment-id }}
body: ${{ steps.build-comment-body.outputs.body }}
edit-mode: replace
1 change: 1 addition & 0 deletions .github/workflows/lost-pixel.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: 'Lost Pixel'
on: [push]

jobs:
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/scripts/generate-redirects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

body="This PR probably requires the following redirects to be added to vercel.json:%0A%0A"
no_changed_pages="%0A- This PR does not change any pages in a way that would require a redirect."

echo $GITHUB_BASE_REF
git status -s
git fetch
git reset --soft origin/$GITHUB_BASE_REF
git status -s
status=$(git status -s)

while IFS= read -r line
do
# Split line into parts
IFS=' '
read -ra values <<< "$line"
# for value in "${values[@]}"; do
# echo "$value"
# done

# Skip if line does not indicate modification or rename
if [[ "${values[0]}" != "D" && "${values[0]}" != "R" ]]; then
continue
fi

# Delete msg for no edited pages and start code block
if [ -n "$no_changed_pages" ]; then
no_changed_pages=""
body="$body""\`\`\`%0A"
fi

# name pieces (and replace `/index` from files (to get to a filename that would be equivalent))
action=${values[0]}
path1=$(echo "${values[1]}" | sed -e 's#/index##g' )
path2=$(echo "${values[3]}" | sed -e 's#/index##g' )

# Skip if file names are identical (probably via `/index` replacement above)
if [[ "$path1" == "$path2" ]]; then
continue
fi

# clean paths
path1_cleaned=$(echo "$path1" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' )
path2_cleaned=$(echo "$path2" | sed -E 's:content/:/:g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' )

# special case for deletion
if [[ "${values[0]}" == "D" ]]; then
path2_cleaned="/##( TODO: Path of page that replaces deleted page )##"
fi

redirect=$(cat <<-END
{
"source": "/docs$path1_cleaned",
"destination": "/docs$path2_cleaned"
},
END
)
echo $redirect
echo ""
body="$body$redirect%0A"

#echo "foo"


done < <(printf '%s\n' "$status")

body="$body$no_changed_pages"
body=$(echo "$body" | sed ':a;N;$!ba;s/\n/%0A/g')
echo $body

echo "::set-output name=body::$body"

28 changes: 28 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Documentation Checks

on:
push:
branches:
- main
paths:
- 'content/**/*'
pull_request:
branches:
- main
paths:
- 'content/**/*'
jobs:
spellcheck:
name: 'Docs: Spellcheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Install cSpell
run: npm install -g cspell

- name: Run cSpell
run: cspell --config ./cSpell.json "content/**/*.mdx" --no-progress
152 changes: 152 additions & 0 deletions cSpell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"version": "0.2",
"language": "en",
"words": [
"Amplication",
"Autoincrementing",
"baselined",
"Baselining",
"cockroachdb",
"codemod",
"codemods",
"datamodel",
"datasource",
"earlyaccess",
"ecommerce",
"Fastify",
"fulltext",
"Hasura",
"hotfix",
"hotfixing",
"idempotency",
"InnoDB",
"ISAM",
"livestream",
"microservices",
"Middlewares",
"MSSQLSERVER",
"neovim",
"Nestjs",
"Overfetching",
"pgbouncer",
"planetscale",
"pooler",
"poolers",
"preconfigure",
"preconfigured",
"Quickstart",
"refactorings",
"roadmap",
"signup",
"sqlserver",
"TLDR",
"triaging",
"upsert",
"upserts",
"upvote",
"walkthrough",
"healthcheck",
"runtimes",
"substep",
"substeps",
"Supabase",
"Redistributable",
"Nuxt",
"Sveltekit",
"Pothos",
"backoff",
"Replibyte",
"Snaplet",
"Kysely",
"Turso",
"autocompletions",
"Formbricks",
"Openform",
"Documenso",
"Docusign",
"ghostfolio",
"Scholarsome",
"Dittofeed",
"Webstudio",
"Dyrector",
"Coolify",
"hostable",
"Rallly",
"Dundring",
"Letterpad",
"Hitori",
"Zenstack"
],
"ignoreWords": [
"Ania",
"Koyeb",
"Neward",
"nikolasburk",
"Slonik",
"Superstruct",
"Tottem",
"tsdf",
"Typebot",
"umami",
"Vitess",
"libgcc",
"libc",
"Distroless",
"Nikolas",
"Supavisor",
"inshellisense",
"janedoe"
],
"patterns": [
{
"name": "Markdown links",
"pattern": "\\((.*)\\)",
"description": ""
},
{
"name": "Markdown code blocks",
"pattern": "/^(\\s*`{3,}).*[\\s\\S]*?^\\1/gmx",
"description": "Taken from the cSpell example at https://cspell.org/configuration/patterns/#verbose-regular-expressions"
},
{
"name": "Inline code blocks",
"pattern": "\\`([^\\`\\r\\n]+?)\\`",
"description": "https://stackoverflow.com/questions/41274241/how-to-capture-inline-markdown-code-but-not-a-markdown-code-fence-with-regex"
},
{
"name": "Link contents",
"pattern": "\\<a(.*)\\>",
"description": ""
},
{
"name": "Snippet references",
"pattern": "-- snippet:(.*)",
"description": ""
},
{
"name": "Snippet references 2",
"pattern": "\\<\\[sample:(.*)",
"description": "another kind of snippet reference"
},
{
"name": "Multi-line code blocks",
"pattern": "/^\\s*```[\\s\\S]*?^\\s*```/gm"
},
{
"name": "HTML Tags",
"pattern": "<[^>]*>",
"description": "Reference: https://stackoverflow.com/questions/11229831/regular-expression-to-remove-html-tags-from-a-string"
}
],
"ignoreRegExpList": [
"Markdown links",
"Markdown code blocks",
"Inline code blocks",
"Link contents",
"Snippet references",
"Snippet references 2",
"Multi-line code blocks",
"HTML Tags"
],
"ignorePaths": []
}
2 changes: 0 additions & 2 deletions content/500-platform/30-maturity-levels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ You can [check out the releases and maturity process for the Prisma ORM](/orm/mo

</TopBlock>

##

### Early Access

If a feature on the Prisma Data Platform is labeled as **Early Access**:
Expand Down

0 comments on commit b9477c3

Please sign in to comment.