mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-10-31 10:54:15 +01:00 
			
		
		
		
	fix: Prevent duplicate comments by validation workflow
This commit is contained in:
		
							
								
								
									
										27
									
								
								.github/workflows/validate-lockfile.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/validate-lockfile.yml
									
									
									
									
										vendored
									
									
								
							| @@ -55,16 +55,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