Skip to content

Clear the nf-test PR comment once its failure is fixed - #4436

Open
FelixKrueger wants to merge 1 commit into
nf-core:devfrom
FelixKrueger:fix/pr-comment-clear-on-pass
Open

Clear the nf-test PR comment once its failure is fixed#4436
FelixKrueger wants to merge 1 commit into
nf-core:devfrom
FelixKrueger:fix/pr-comment-clear-on-pass

Conversation

@FelixKrueger

Copy link
Copy Markdown

The ❌ nf-test comment for latest-everything failures can currently only be added, never cleared. The producer writes pr-comment/comment.md only when failure fragments exist, so once a PR fixes the failure the poster has nothing to publish and the previous comment stays put — a green PR keeps showing a stale cross. This adds an optional delete marker to the pr-comment artifact contract: nf-test touches it when no leg failed, and the poster deletes that header's comment instead of posting one. Producers that write neither file behave exactly as before, so linting, template-version and branch-protection comments are untouched.

Verification notes (AI-assisted)

Found on a real pipeline PR (nf-core/riboseq#222), which sat fully green while displaying a failure comment that pointed at a cancelled run. The comment cannot self-clear, so it had to be corrected by hand.

  • delete is a real input on marocchino/sticky-pull-request-comment at the already-pinned SHA 5770ad5 (v3.0.5): "delete the previously created comment. Only true is allowed." Deletion is scoped by header, so producers stay independent of one another.
  • Simulated the reworked metadata step over five cases: comment.md present → post; delete marker only → delete; neither → early exit unchanged (the path the other three producers take); both present → post wins; delete marker with an empty PR number → the existing numeric guard still rejects it.
  • nf-test.yml also fires on release and workflow_dispatch, where github.event.pull_request.number is empty. Those never reach the poster, which is gated on github.event.workflow_run.event == 'pull_request', so the new marker cannot trip that guard.
  • The new step is inside the existing {% raw %} block, so its ${{ ... }} expressions are not Jinja-interpreted; {%- endraw %} moves to the new final line. pr-comment.yml parses as YAML with the raw tags stripped. nf-test.yml's change is inside a run: | block scalar.

The sticky comment for latest-everything failures can only ever be added. The
producer writes pr-comment/comment.md solely when failure fragments exist, so a
run that goes green leaves the poster nothing to publish and the previous
failure comment stands unchanged. Any PR that fixes such a failure then carries
a permanently misleading cross.

Add an optional `delete` marker to the pr-comment artifact contract. nf-test
touches it when no leg failed, and the poster deletes that header's comment
instead of posting one. Producers that write neither file are unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant