Skip to content

Update 100-custom-model-and-field-names.mdx #9158

Update 100-custom-model-and-field-names.mdx

Update 100-custom-model-and-field-names.mdx #9158

name: List Changed Pages
on:
pull_request:
branches:
- main
paths:
- "content/**/*"
permissions:
actions: read
checks: read
contents: read
issues: write
pull-requests: write
jobs:
post-files-changed-comment:
name: "Post files changed comment"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get all changed markdown files
id: changed-files
uses: tj-actions/changed-files@v45
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 }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
shopt -s extglob # enable extended globbing
OUTPUT=""
if [ ${CHANGED_FILES} == 'true' ]; then
OUTPUT="| original | preview |%0A| ------ | ------ |%0A"
for file in ${ALL_CHANGED_FILES}
do
FILE_PATH=${file//+([0-9])-/} # remove numeric prefixes
FILE_PATH=${FILE_PATH#content\/} # remove "content/"
FILE_PATH=${FILE_PATH%.mdx} # remove ".mdx"
FILE_PATH=${FILE_PATH%index} # remove "index"
BRANCH_NAME=${BRANCH_NAME:0:28} # shorten branch name for preview link to a maximum of 28 characters
OUTPUT+="| [${file}](https://www.prisma.io/docs/${FILE_PATH}) | [${file}](https://${BRANCH_NAME//\//-}.docs-51g.pages.dev/${FILE_PATH}) |%0A"
done
else
OUTPUT="No files changed."
fi
echo "::set-output name=body::$OUTPUT"
shopt -u extglob # disable extended globbing
- name: Post comment
uses: ./.github/actions/create-or-update-comment
with:
pull-request: ${{ github.event.pull_request.number }}
body: ${{ steps.build-comment-body.outputs.body }}
body-includes: "original | preview"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}