Added validation for packages/mermaid/src/vitepress path

This commit is contained in:
shubham-mermaid
2025-06-20 13:18:50 +05:30
parent 334c8c2962
commit e1030b186e

View File

@@ -15,7 +15,6 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
# so we have both base and head SHAs to diff
fetch-depth: 0 fetch-depth: 0
- name: Set up Node.js - name: Set up Node.js
@@ -23,18 +22,21 @@ jobs:
with: with:
node-version: 20 node-version: 20
- name: Check pnpm-lock.yaml for tarball fields and unexpected paths - name: Validate pnpm-lock.yaml entries
run: | run: |
if grep -q 'tarball:' pnpm-lock.yaml; then forbidden=(
echo "❌ tarball field found in pnpm-lock.yaml" 'tarball:' # no tarball fields
exit 1 'packages/mermaid/src/vitepress' # no vitepress paths
fi )
if grep -q 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
echo "❌ Unexpected path found in pnpm-lock.yaml"
exit 1
fi
- name: Ensure pnpm-lock.yaml changes only when package.json changes for pat in "${forbidden[@]}"; do
if grep -qF "$pat" pnpm-lock.yaml; then
echo "❌ Forbidden pattern \"$pat\" found in pnpm-lock.yaml"
exit 1
fi
done
- name: Ensure pnpm-lock.yaml only when package.json changes
run: | run: |
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed_files.txt git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed_files.txt
if grep -q '^pnpm-lock.yaml$' changed_files.txt && \ if grep -q '^pnpm-lock.yaml$' changed_files.txt && \