-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/language-server
- Loading branch information
Showing
825 changed files
with
24,135 additions
and
13,385 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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,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 }} |
This file contains 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 |
---|---|---|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 |
This file contains 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,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 }} |
This file contains 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,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" | ||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -85,5 +85,8 @@ content/00-example.mdx | |
.vscode/ | ||
.vercel | ||
|
||
# nova settings | ||
.nova | ||
|
||
# gatsby typegen | ||
src/gatsby-types.d.ts |
This file contains 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.