Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jharrell authored Apr 16, 2024
2 parents 9d18800 + 63a2fb4 commit 9e6afe6
Show file tree
Hide file tree
Showing 970 changed files with 44,968 additions and 73,122 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor config
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
max_line_length = 100
trim_trailing_whitespace = true

[*.{md,mdx}]
insert_final_newline = false
trim_trailing_whitespace = false
8 changes: 0 additions & 8 deletions .env.example

This file was deleted.

11 changes: 0 additions & 11 deletions .flycode.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content/* @prisma/dev-advocates-write
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
directory: "/"
schedule:
interval: "weekly"
4 changes: 2 additions & 2 deletions .github/workflows/image-optimise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Compress Images
id: calibre
Expand All @@ -51,7 +51,7 @@ jobs:
if: |
github.event_name != 'pull_request' &&
steps.calibre.outputs.markdown != ''
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6.0.3
with:
title: Auto Compress Images
branch-suffix: timestamp
Expand Down
123 changes: 43 additions & 80 deletions .github/workflows/list-changed-pages.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,62 @@
name: Comment based on changed pages (Vercel Deploy URLs + Redirect Suggestions)

name: List Changed Pages
on:
pull_request:
branches:
- main
- docusaurus
paths:
- 'content/**/*'

jobs:
post-comment-with-links-to-changed-pages:
name: Create or Update
post-files-changed-comment:
name: 'Post files changed comment'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get list of changed files
id: files
uses: Ana06/[email protected] # it's a fork of jitterbit/get-changed-files@v1 which works better with pull requests
- name: List Vercel Deploy URLs
id: links
# Note that this uses `%0A` instead of `\n` because of https://github.com/peter-evans/create-or-update-comment#setting-the-comment-body-from-a-file which I could not get to work here - but this brute force method does.
run: |
body="This PR changes the following pages (Vercel Preview Deploy links):%0A%0A"
no_changed_pages="%0A- This PR does not change any pages the [GH Actions workflow](https://github.com/prisma/docs/blob/main/.github/workflows/list-changed-pages.yml) could detect."
vercelLinks="Changed Vercel links"
body="$body%0A%0A$vercelLinks"
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ $changed_file == content/* ]]
then
no_changed_pages=""
cleaned_file=$(echo "$changed_file" | sed -E 's:content/:/:g' | sed -E 's:/index.mdx::g' | sed -e 's/.mdx//g' | sed -E 's:/[0-9]+-:/:g' )
branch_name=$(echo "${{github.event.pull_request.head.ref}}" | sed -e 's/\//-/g')
# TODO special case for images and similar non .mdx files
# Output inside the action
echo "- https://docs-git-${branch_name}-prisma.vercel.app$cleaned_file"
# Also collect into string
linksVercel="%0A- [/docs$cleaned_file](https://docs-git-${branch_name}-prisma.vercel.app$cleaned_file) ([currently](https://prisma.io/docs$cleaned_file))"
body="$body$linksVercel"
fi
done
body="$body$no_changed_pages"
body="$body%0A%0A(Note that links will only be valid after Vercel preview deploy succeeded)"
echo "::set-output name=body::$body"
- name: Find existing comment (links)
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: following pages
- uses: actions/checkout@v4

- name: Create comment (links)
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
- name: Get all changed markdown files
id: changed-files
uses: tj-actions/changed-files@v44
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.links.outputs.body }}
files: content/**/*.{md,mdx}

- name: Update comment (links)
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: ${{ steps.links.outputs.body }}
edit-mode: replace

### REDIRECTS ###

- name: Create suggested redirects
id: redirects
- 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: |
bash .github/workflows/scripts/generate-redirects.sh
- name: Find existing comment (redirects)
uses: peter-evans/find-comment@v1
id: fc2
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@v3
id: find-existing
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: following redirects
body-includes: 'original | preview'

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

- name: Update comment (redirects)
if: steps.fc2.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v1
- name: Update comment
if: steps.find-existing.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc2.outputs.comment-id }}
body: ${{ steps.redirects.outputs.body }}
comment-id: ${{ steps.find-existing.outputs.comment-id }}
body: ${{ steps.build-comment-body.outputs.body }}
edit-mode: replace
49 changes: 22 additions & 27 deletions .github/workflows/lost-pixel.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
name: LostPixel

name: 'Lost Pixel'
on: [push]

jobs:
gatsby-for-percy:
name: Lost Pixel screenshots via Gatsby build
build:
runs-on: ubuntu-latest
name: Lost Pixel

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: '14'
- run: npm ci
- name: Caching Gatsby
id: gatsby-cache-build
uses: actions/cache@v2
with:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gatsby-build-
- name: Build Gatsby app
run: npx gatsby build --prefix-paths
env:
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true
CI: true
node-version: 18

- name: Install deps
run: npm install

- name: Build docs
run: npm run clean && npm run build

- name: Start docs
run: npm run serve &

- name: Generate sitemap
run: npx lost-pixel page-sitemap-gen http://172.17.0.1:3000/sitemap.xml "./lost-pixel-pages.json"

- name: Run Gatsby app
run: npx gatsby serve --host 172.17.0.1 &
- name: Edit page names
run: sed -i -e 's/_/\//g' -e 's|prisma\.io||g' -re 's/(name.+)(\/)(\")/\1-\3/g' lost-pixel-pages.json

- name: Lost Pixel
uses: lost-pixel/lost-pixel@v3.4.4
uses: lost-pixel/lost-pixel@v3.16.0
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}
36 changes: 0 additions & 36 deletions .github/workflows/notion.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
name: 'Docs: Spellcheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Check out the code
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
name: Setup node
with:
node-version: '18'
Expand Down
Loading

0 comments on commit 9e6afe6

Please sign in to comment.