From cc4a5de394633d15940f096ec0c67222afd029cf Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 9 Apr 2024 14:31:46 +0300 Subject: [PATCH 1/4] 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. --- .github/actions/quic-interop-runner/action.yml | 7 ++----- .github/workflows/qns-comment.yml | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/actions/quic-interop-runner/action.yml b/.github/actions/quic-interop-runner/action.yml index 7fd055f184..cdc617d275 100644 --- a/.github/actions/quic-interop-runner/action.yml +++ b/.github/actions/quic-interop-runner/action.yml @@ -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' \ @@ -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 diff --git a/.github/workflows/qns-comment.yml b/.github/workflows/qns-comment.yml index 71cbcc805b..8bbc4a7d32 100644 --- a/.github/workflows/qns-comment.yml +++ b/.github/workflows/qns-comment.yml @@ -18,8 +18,7 @@ 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 From 6cf5a29debe4851b36689b33eb3edfc7a56601e1 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 9 Apr 2024 15:18:17 +0300 Subject: [PATCH 2/4] Delete comment on success --- .github/actions/pr-comment/action.yml | 3 +++ .github/workflows/bench-comment.yml | 1 + .github/workflows/qns-comment.yml | 1 + 3 files changed, 5 insertions(+) diff --git a/.github/actions/pr-comment/action.yml b/.github/actions/pr-comment/action.yml index b7f9bb12da..0c93ac317b 100644 --- a/.github/actions/pr-comment/action.yml +++ b/.github/actions/pr-comment/action.yml @@ -5,6 +5,9 @@ inputs: name: description: 'Artifact name to import comment data from.' required: true + mode: + description: 'Mode of operation (upsert/recreate/delete).' + required: true token: description: 'A Github PAT' required: true diff --git a/.github/workflows/bench-comment.yml b/.github/workflows/bench-comment.yml index f89d223059..0de346dc06 100644 --- a/.github/workflows/bench-comment.yml +++ b/.github/workflows/bench-comment.yml @@ -25,4 +25,5 @@ jobs: - uses: ./.github/actions/pr-comment with: name: bench + mode: upsert token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/qns-comment.yml b/.github/workflows/qns-comment.yml index 8bbc4a7d32..db9f74f7bf 100644 --- a/.github/workflows/qns-comment.yml +++ b/.github/workflows/qns-comment.yml @@ -24,4 +24,5 @@ jobs: - uses: ./.github/actions/pr-comment with: name: qns + mode: ${{ github.event.workflow_run.conclusion == 'success' && 'delete' || 'upsert' }} token: ${{ secrets.GITHUB_TOKEN }} From 3b9d753466171578a5b278f0319d4f1e5054658f Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 9 Apr 2024 15:36:47 +0300 Subject: [PATCH 3/4] Update .github/actions/pr-comment/action.yml Co-authored-by: Max Inden Signed-off-by: Lars Eggert --- .github/actions/pr-comment/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pr-comment/action.yml b/.github/actions/pr-comment/action.yml index 0c93ac317b..017bcb64b9 100644 --- a/.github/actions/pr-comment/action.yml +++ b/.github/actions/pr-comment/action.yml @@ -7,7 +7,7 @@ inputs: required: true mode: description: 'Mode of operation (upsert/recreate/delete).' - required: true + default: 'upsert' token: description: 'A Github PAT' required: true From 475eb12d63bc76aa8c630ab074dd1480b9ef9554 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 9 Apr 2024 15:37:38 +0300 Subject: [PATCH 4/4] Address code review --- .github/actions/pr-comment/action.yml | 1 + .github/workflows/bench-comment.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pr-comment/action.yml b/.github/actions/pr-comment/action.yml index 0c93ac317b..18a11273cf 100644 --- a/.github/actions/pr-comment/action.yml +++ b/.github/actions/pr-comment/action.yml @@ -32,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 diff --git a/.github/workflows/bench-comment.yml b/.github/workflows/bench-comment.yml index 0de346dc06..f89d223059 100644 --- a/.github/workflows/bench-comment.yml +++ b/.github/workflows/bench-comment.yml @@ -25,5 +25,4 @@ jobs: - uses: ./.github/actions/pr-comment with: name: bench - mode: upsert token: ${{ secrets.GITHUB_TOKEN }}