-
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.
- Loading branch information
Showing
42 changed files
with
1,128 additions
and
339 deletions.
There are no files selected for viewing
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: Post Comment | ||
description: Create or update a comment on a pull request | ||
inputs: | ||
pull-request: | ||
description: The PR (number) to post in | ||
required: true | ||
body: | ||
description: The comment body (will replace if comment already exists) | ||
required: true | ||
body-includes: | ||
description: An optional string to search by (use this almost always) | ||
required: false | ||
default: 'bot' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Find existing comment | ||
uses: peter-evans/find-comment@v3 | ||
id: find-existing | ||
with: | ||
issue-number: ${{ inputs.pull-request }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: ${{ inputs.body-includes }} | ||
|
||
- name: Create comment | ||
if: steps.find-existing.outputs.comment-id == '' | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
issue-number: ${{ inputs.pull-request }} | ||
body: ${{ inputs.body }} | ||
|
||
- name: Update comment | ||
if: steps.find-existing.outputs.comment-id != '' | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
comment-id: ${{ steps.find-existing.outputs.comment-id }} | ||
body: ${{ inputs.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,107 @@ | ||
name: Check all content (MDX) links | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-for-absolute-urls: | ||
name: "Check for absolute prisma.io urls" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: check for docs urls | ||
id: absolute-urls | ||
run: | | ||
FILES_WITH_ABS_URLS=$(grep -Erl "https://prisma\.io/docs|https://www\.prisma\.io/docs" content) || echo "no absolute URLs found." | ||
OUTPUT="## Absolute URL check"$'\n' | ||
SUCCESS=false | ||
if [ -n "${FILES_WITH_ABS_URLS}" ]; then # if there were matching files | ||
OUTPUT+="The following files have absolute URLs to prisma.io/docs. Please replace them with relative URLs."$'\n' | ||
OUTPUT+="Example: https://www.prisma.io/docs/getting-started/quickstart -> /getting-started/quickstart"$'\n' | ||
for line in ${FILES_WITH_ABS_URLS} | ||
do | ||
OUTPUT+="${line}"$'\n' | ||
done | ||
else | ||
# no matching files | ||
OUTPUT+="No absolute URLs to prisma.io/docs found." | ||
SUCCESS=true | ||
fi | ||
# https://github.com/orgs/community/discussions/26288#discussioncomment-3876281 | ||
{ | ||
echo 'body<<EOF' | ||
echo "$OUTPUT" | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
echo "success=${SUCCESS}" >> "$GITHUB_OUTPUT" | ||
- uses: ./.github/actions/create-or-update-comment | ||
with: | ||
pull-request: ${{ github.event.pull_request.number }} | ||
body: ${{ steps.absolute-urls.outputs.body }} | ||
body-includes: absolute URLs | ||
|
||
- name: report success | ||
run: | | ||
if ${{ steps.absolute-urls.outputs.success }}; then | ||
exit 0; | ||
else | ||
exit 1; | ||
fi | ||
check-for-dead-external-links: | ||
name: Check external links | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install deps | ||
run: npm install | ||
|
||
- name: Install remark presets | ||
run: npm install remark-lint-no-dead-urls | ||
|
||
- name: run remark-cli | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
run: | | ||
npx remark-cli . -qf -e=md,mdx --use=remark-mdx --use remark-frontmatter --use remark-gfm \ | ||
--use "remark-lint-no-dead-urls=skipLocalhost:true,skipUrlPatterns:['https://www.notion.so/prismaio','https://www.prisma.io/docs','https://dash.cloudflare.com','https://www.cloudflare.com']" | ||
check-for-dead-internal-links: | ||
name: Check internal links | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install deps | ||
run: npm install | ||
|
||
- name: test build | ||
run: npm run clean && npm run build | ||
|
||
check-for-redirects: | ||
name: Check for needed redirects | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create suggested redirects | ||
id: redirects | ||
run: | | ||
bash .github/workflows/scripts/generate-redirects.sh | ||
- uses: ./.github/actions/create-or-update-comment | ||
with: | ||
pull-request: ${{ github.event.pull_request.number }} | ||
body: ${{ steps.redirects.outputs.body }} | ||
body-includes: following redirects |
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
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
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
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
Oops, something went wrong.