mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 16:29:40 +02:00
Added generic message.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'mermaid': minor
|
||||
---
|
||||
|
||||
chore:Added workflow file for validating pnpm-lock file
|
49
.github/workflows/validate-lockfile.yml
vendored
49
.github/workflows/validate-lockfile.yml
vendored
@@ -23,25 +23,34 @@ jobs:
|
||||
node-version: 20
|
||||
|
||||
- name: Validate pnpm-lock.yaml entries
|
||||
id: validate # give this step an ID so we can reference its outputs
|
||||
run: |
|
||||
forbidden=(
|
||||
'tarball:' # no tarball fields
|
||||
'packages/mermaid/src/vitepress' # no vitepress paths
|
||||
)
|
||||
issues=()
|
||||
|
||||
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
|
||||
# 1) No tarball references
|
||||
if grep -qF 'tarball:' pnpm-lock.yaml; then
|
||||
issues+=("• Tarball references found (forbidden)")
|
||||
fi
|
||||
|
||||
- name: Ensure pnpm-lock.yaml only when package.json changes
|
||||
run: |
|
||||
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed_files.txt
|
||||
if grep -q '^pnpm-lock.yaml$' changed_files.txt && \
|
||||
! grep -q 'package.json' changed_files.txt; then
|
||||
echo "❌ pnpm-lock.yaml was changed without any package.json"
|
||||
# 2) No unwanted vitepress paths
|
||||
if grep -qF 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
|
||||
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present")
|
||||
fi
|
||||
|
||||
# 3) Lockfile only changes when package.json changes
|
||||
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed.txt
|
||||
if grep -q '^pnpm-lock.yaml$' changed.txt && ! grep -q 'package.json' changed.txt; then
|
||||
issues+=("• pnpm-lock.yaml changed without any package.json modification")
|
||||
fi
|
||||
|
||||
# If any issues, output them and fail
|
||||
if [ ${#issues[@]} -gt 0 ]; then
|
||||
# Use the new GITHUB_OUTPUT approach to set a multiline output
|
||||
{
|
||||
echo "errors<<EOF"
|
||||
printf '%s\n' "${issues[@]}"
|
||||
echo "EOF"
|
||||
} >> $GITHUB_OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -54,11 +63,9 @@ jobs:
|
||||
body: |
|
||||
## 🔍 Lockfile Validation Failed
|
||||
|
||||
One or more issues were found in `pnpm-lock.yaml`:
|
||||
- Tarball references are not allowed.
|
||||
- `packages/mermaid/src/vitepress` path must not appear in the lockfile.
|
||||
- `pnpm-lock.yaml` should only change when `package.json` changes.
|
||||
The following issue(s) were detected in `pnpm-lock.yaml`:
|
||||
${{ steps.validate.outputs.errors }}
|
||||
|
||||
Please fix these issues and push an update.
|
||||
Please address these and push an update.
|
||||
|
||||
_Posted automatically by GitHub Actions_
|
||||
|
Reference in New Issue
Block a user