mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-10-31 02:44:17 +01:00 
			
		
		
		
	Merge pull request #7116 from mermaid-js/sidv/lockfileValidation
fix: Lockfile validation
This commit is contained in:
		
							
								
								
									
										31
									
								
								.github/workflows/validate-lockfile.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								.github/workflows/validate-lockfile.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,7 @@ | ||||
| name: Validate pnpm-lock.yaml | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   pull_request_target: | ||||
|     paths: | ||||
|       - 'pnpm-lock.yaml' | ||||
|       - '**/package.json' | ||||
| @@ -15,6 +15,8 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           fetch-depth: 0 | ||||
|           ref: ${{ github.event.pull_request.head.sha }} | ||||
|           repository: ${{ github.event.pull_request.head.repo.full_name }} | ||||
|  | ||||
|       - name: Set up Node.js | ||||
|         uses: actions/setup-node@v4 | ||||
| @@ -55,16 +57,41 @@ jobs: | ||||
|             exit 1 | ||||
|           fi | ||||
|  | ||||
|       - name: Find existing lockfile validation comment | ||||
|         if: always() | ||||
|         uses: peter-evans/find-comment@v3 | ||||
|         id: find-comment | ||||
|         with: | ||||
|           issue-number: ${{ github.event.pull_request.number }} | ||||
|           comment-author: 'github-actions[bot]' | ||||
|           body-includes: 'Lockfile Validation Failed' | ||||
|  | ||||
|       - name: Comment on PR if validation failed | ||||
|         if: failure() | ||||
|         uses: peter-evans/create-or-update-comment@v4 | ||||
|         uses: peter-evans/create-or-update-comment@v5 | ||||
|         with: | ||||
|           token: ${{ secrets.GITHUB_TOKEN }} | ||||
|           issue-number: ${{ github.event.pull_request.number }} | ||||
|           comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||||
|           edit-mode: replace | ||||
|           body: | | ||||
|             ❌ **Lockfile Validation Failed** | ||||
|  | ||||
|             The following issue(s) were detected: | ||||
|             ${{ steps.validate.outputs.errors }} | ||||
|  | ||||
|             Please address these and push an update. | ||||
|  | ||||
|             _Posted automatically by GitHub Actions_ | ||||
|  | ||||
|       - name: Delete comment if validation passed | ||||
|         if: success() && steps.find-comment.outputs.comment-id != '' | ||||
|         uses: actions/github-script@v7 | ||||
|         with: | ||||
|           github-token: ${{ secrets.GITHUB_TOKEN }} | ||||
|           script: | | ||||
|             await github.rest.issues.deleteComment({ | ||||
|               owner: context.repo.owner, | ||||
|               repo: context.repo.repo, | ||||
|               comment_id: ${{ steps.find-comment.outputs.comment-id }}, | ||||
|             }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sidharth Vinod
					Sidharth Vinod