Skip to content

Commit

Permalink
Merge branch 'main' into feat/language-server
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Nov 17, 2023
2 parents 4242616 + 0392b9d commit 48dda8d
Show file tree
Hide file tree
Showing 825 changed files with 24,135 additions and 13,385 deletions.
100 changes: 0 additions & 100 deletions .all-contributorsrc

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ jobs:
runs-on: ubuntu-latest
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '14'
- run: |
npm config set '//npm.fontawesome.com/:_authToken' "${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}"
npm ci
- run: npx gatsby clean
- run: npx gatsby build --prefix-paths
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/image-optimise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# From https://github.com/marketplace/actions/image-actions
# image-actions will run in the following scenarios:
# - on pull requests containing images (not including forks)
# - on pushing of images to main (for forks)
# - on demand (https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/)
# - at 11pm every Sunday just in case anything gets missed with any of the above
# For pull requests, the images are added to the PR
# For the rest a new PR is opened if any images are compressed.
name: Compress images
on:
pull_request:
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
push:
branches:
- main
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
workflow_dispatch:
schedule:
- cron: '00 23 * * 0'
jobs:
build:
name: calibreapp/image-actions
runs-on: ubuntu-latest
# Only run on main repo on and PRs that match the main repo
if: |
github.repository == 'prisma/docs' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout Branch
uses: actions/checkout@v2

- name: Compress Images
id: calibre
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
# For non-pull requests, run in compressOnly mode and we'll PR after
compressOnly: ${{ github.event_name != 'pull_request' }}

- name: Create Pull Request
# If it's not a pull request then commit any changes as a new PR
if: |
github.event_name != 'pull_request' &&
steps.calibre.outputs.markdown != ''
uses: peter-evans/create-pull-request@v3
with:
title: Auto Compress Images
branch-suffix: timestamp
commit-message: Compress Images
body: ${{ steps.calibre.outputs.markdown }}
41 changes: 37 additions & 4 deletions .github/workflows/list-changed-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Comment with Vercel Deploy URLs of changed pages
name: Comment based on changed pages (Vercel Deploy URLs + Redirect Suggestions)

on:
pull_request:
Expand All @@ -9,6 +9,9 @@ jobs:
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
Expand Down Expand Up @@ -42,25 +45,55 @@ jobs:
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
- 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

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

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

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

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

on: [push]

jobs:
gatsby-for-percy:
name: Lost Pixel screenshots via Gatsby build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
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

- name: Run Gatsby app
run: npx gatsby serve --host 172.17.0.1 &

- name: Lost Pixel
uses: lost-pixel/[email protected]
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}
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"

2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/setup-node@v1
name: Setup node
with:
node-version: '16'
node-version: '18'
- run: npm install -g cspell
name: Install cSpell
- run: cspell --config ./cSpell.json "content/**/*.mdx" --no-progress
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ content/00-example.mdx
.vscode/
.vercel

# nova settings
.nova

# gatsby typegen
src/gatsby-types.d.ts
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"tabWidth": 2,
"trailingComma": "es5",
"semi": false,
"plugins": ["prettier-plugin-prisma"],
"overrides": [
{
"files": "*.mdx",
Expand Down
Loading

0 comments on commit 48dda8d

Please sign in to comment.