Skip to content

Commit

Permalink
ci: Delete QNS PR comment on successful run (#1807)
Browse files Browse the repository at this point in the history
* ci: Always add or update the QNS PR comment

Because we only add one when there is a failure, and when things then
later get fixed we don't update it again (because we skip the update
on success). So the outdated, failed state keeps being shown.

* Delete comment on success

* Update .github/actions/pr-comment/action.yml

Co-authored-by: Max Inden <[email protected]>
Signed-off-by: Lars Eggert <[email protected]>

* Address code review

---------

Signed-off-by: Lars Eggert <[email protected]>
Co-authored-by: Max Inden <[email protected]>
  • Loading branch information
larseggert and mxinden authored Apr 9, 2024
1 parent 7ff76c7 commit c6c60ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/actions/pr-comment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
name:
description: 'Artifact name to import comment data from.'
required: true
mode:
description: 'Mode of operation (upsert/recreate/delete).'
default: 'upsert'
token:
description: 'A Github PAT'
required: true
Expand All @@ -29,5 +32,6 @@ runs:
- uses: thollander/actions-comment-pull-request@v2
with:
filePath: contents
mode: ${{ inputs.mode }}
pr_number: ${{ steps.pr-number.outputs.number }}
comment_tag: ${{ inputs.name }}-comment
7 changes: 2 additions & 5 deletions .github/actions/quic-interop-runner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,9 @@ runs:
- name: Format GitHub comment
if: always()
run: |
if [ -s quic-interop-runner/summary ]; then
exit 0
fi
echo '[**QUIC Interop Runner**](https://github.com/quic-interop/quic-interop-runner)' >> comment
echo '' >> comment
# Ignore all, but table, which starts with "|".
# Ignore all, but table, which starts with "|". Also reformat it to GitHub Markdown.
grep -E '^\|' quic-interop-runner/summary |\
awk '(!/^\| *:-/ || (d++ && d < 3))' |\
sed -E -e 's/✓/:white_check_mark:/gi' -e 's/✕/:x:/gi' -e 's/\?/:grey_question:/gi' \
Expand All @@ -106,7 +103,7 @@ runs:
shell: bash

- name: Export PR comment data
if: env.EXPORT_COMMENT == '1'
if: always()
uses: ./.github/actions/pr-comment-data-export
with:
name: qns
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qns-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
github.event.workflow_run.event == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pr-comment
with:
name: qns
mode: ${{ github.event.workflow_run.conclusion == 'success' && 'delete' || 'upsert' }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c6c60ba

Please sign in to comment.