mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-01 03:14:10 +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
|
exit 1
|
||||||
fi
|
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
|
- name: Comment on PR if validation failed
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
|
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||||
|
edit-mode: replace
|
||||||
body: |
|
body: |
|
||||||
|
❌ **Lockfile Validation Failed**
|
||||||
|
|
||||||
The following issue(s) were detected:
|
The following issue(s) were detected:
|
||||||
${{ steps.validate.outputs.errors }}
|
${{ steps.validate.outputs.errors }}
|
||||||
|
|
||||||
Please address these and push an update.
|
Please address these and push an update.
|
||||||
|
|
||||||
_Posted automatically by GitHub Actions_
|
_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