diff --git a/.github/workflows/link_checker_workflow.yaml b/.github/workflows/link_checker_workflow.yaml index 7b53670d771..2edbb92c6c3 100644 --- a/.github/workflows/link_checker_workflow.yaml +++ b/.github/workflows/link_checker_workflow.yaml @@ -80,7 +80,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Find comment - if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' uses: peter-evans/find-comment@v3 id: find-comment with: @@ -88,6 +87,16 @@ jobs: comment-author: 'github-actions[bot]' body-includes: "## Link Resolution Note" + - name: Delete comment on success + if: steps.lychee-check.outcome == 'success' && steps.find-comment.outputs.comment-id != '' + run: | + gh api \ + --method DELETE \ + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/issues/comments/${{ steps.find-comment.outputs.comment-id }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Prepare Report if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' run: | @@ -102,15 +111,6 @@ jobs: # Clean the report (remove redirects) AND append it to the file sed -E '/(Redirect|Redirects per input)/d' lychee-report.md >> full-report.md - - name: Delete comment on success - if: steps.lychee-check.outcome == 'success' && steps.find-comment.outputs.comment-id != '' - run: | - gh api \ - --method DELETE \ - -H "Accept: application/vnd.github+json" \ - /repos/${{ github.repository }}/issues/comments/${{ steps.find-comment.outputs.comment-id }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create PR Comment if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure'