Skip to content

Commit f4dc8c6

Browse files
committed
Remove docs and deps comments when there are no modified crates
1 parent 34a9f1c commit f4dc8c6

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/pr-metadata-docs-and-deps.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,30 @@ jobs:
180180
body-path: doc-check-results.md
181181
edit-mode: replace
182182

183+
missing-docs-delete:
184+
needs: changed-crates
185+
if: needs.changed-crates.outputs.crates_count == 0
186+
runs-on: ubuntu-latest
187+
permissions:
188+
pull-requests: write
189+
steps:
190+
- name: Find existing comment
191+
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
192+
id: find-comment
193+
with:
194+
issue-number: ${{ github.event.pull_request.number }}
195+
comment-author: 'github-actions[bot]'
196+
body-includes: '## 📚 Documentation Check Results'
197+
- name: Delete existing docs comment
198+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
199+
with:
200+
script: |
201+
github.issues.deleteComment({
202+
owner: context.repo.owner,
203+
repo: context.repo.repo,
204+
comment_id: ${{ steps.find-comment.outputs.comment-id }},
205+
})
206+
183207
changelog-check:
184208
needs: changed-crates
185209
if: |
@@ -338,3 +362,27 @@ jobs:
338362
run: |
339363
echo "cargo-deny found ${{ steps.cargo-deny.outputs.total_errors }} error(s) and FAIL_IF_CARGO_DENY is enabled"
340364
exit 1
365+
366+
dependency-check-delete:
367+
needs: changed-crates
368+
if: needs.changed-crates.outputs.crates_count == 0
369+
runs-on: ubuntu-latest
370+
permissions:
371+
pull-requests: write
372+
steps:
373+
- name: Find existing comment
374+
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
375+
id: find-comment
376+
with:
377+
issue-number: ${{ github.event.pull_request.number }}
378+
comment-author: 'github-actions[bot]'
379+
body-includes: '## 🔒 Cargo Deny Results'
380+
- name: Delete existing dependency check comment
381+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
382+
with:
383+
script: |
384+
github.issues.deleteComment({
385+
owner: context.repo.owner,
386+
repo: context.repo.repo,
387+
comment_id: ${{ steps.find-comment.outputs.comment-id }},
388+
})

0 commit comments

Comments
 (0)