[
https://issues.apache.org/jira/browse/NUTCH-3208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109742#comment-18109742
]
ASF GitHub Bot commented on NUTCH-3208:
---------------------------------------
lewismc opened a new pull request, #963:
URL: https://github.com/apache/nutch/pull/963
(yetus): post a sticky report from a `workflow_run` companion so fork PRs
can comment. Find the existing comment with `gh`; generate markdown on
`pull_request` only.
PR fixes part 2 of
[NUTCH-3208](https://issues.apache.org/jira/browse/NUTCH-3208)
Again, unfortunately, the GitHub workflow result cannot be properly
validated unless it is merged into `master` and then the workflow is run on a
new incoming PR...which is what I did in my local setup.
> GitHub Actions JUnit and Yetus workflows do not reliably post PR comments
> -------------------------------------------------------------------------
>
> Key: NUTCH-3208
> URL: https://issues.apache.org/jira/browse/NUTCH-3208
> Project: Nutch
> Issue Type: Task
> Components: ci/cd
> Affects Versions: 1.23
> Reporter: Lewis John McGibbney
> Assignee: Lewis John McGibbney
> Priority: Minor
> Fix For: 1.24
>
>
> h3. Problem
> The JUnit report workflow never posts a comment on the GitHub PR. The Apache
> Yetus workflow only comments sometimes (same-repo PRs such as Dependabot).
> Fork PRs usually get no Yetus comment.
> Intended behavior (NUTCH-3126 and the Yetus workflow) is a report on the PR
> thread.
> h3. Evidence
> * Yetus comment present (same-repo / Dependabot):
> [https://github.com/apache/nutch/pull/961#issuecomment-5405632841]
> * Matching junit-report run succeeded with no PR comment:
> [https://github.com/apache/nutch/actions/runs/32812407266]
> h3. Causes
> *JUnit* ({{{}.github/workflows/junit-report.yml{}}}):
> * {{skip_success_summary: true}} — mikepenz/action-junit-report builds empty
> tables when all tests pass, then skips {{{}attachComment{}}}. Green PRs get
> no comment.
> * Job {{if: github.event.workflow_run.conclusion == 'success'}} — if tests
> fail, parent CI is {{failure}} and the reporter is skipped even though XML
> was uploaded ({{{}if: always(){}}}).
> * Path-filtered PRs upload no XML — stay silent (no fallback comment). That
> is acceptable.
> *Yetus* ({{{}.github/workflows/yetus.yml{}}}):
> * Comment is posted from the {{pull_request}} job with {{{}GITHUB_TOKEN{}}}.
> Fork PRs get HTTP 403.
> * {{continue-on-error: true}} hides those failures.
> * A repo PAT is not a fork fix: secrets are not available to fork
> {{pull_request}} runs. Do not use {{{}pull_request_target{}}}.
> h3. Fix (two GitHub PRs)
> # *JUnit:* {{{}skip_success_summary: false{}}}; keep compact totals
> ({{{}include_passed: false{}}}); run reporter when parent is success *or*
> failure and the event is {{{}pull_request{}}}; sticky {{{}updateComment{}}};
> skip publish if no XML; resolve PR number only for {{apache/nutch}} (do not
> trust a fork's {{{}pull_requests[0]{}}}).
> # *Yetus:* generate the markdown report on {{pull_request}} and upload it;
> post/update one sticky comment from a new {{workflow_run}} companion
> (base-repo token, no checkout of PR head). Remove in-workflow peter-evans
> comment and {{{}continue-on-error{}}}.
> h3. Acceptance
> * Green PR that ran tests: sticky JUnit totals comment; later pushes update
> it.
> * Failing tests (parent {{{}failure{}}}): JUnit comment still appears.
> * Path-filter / no XML: no JUnit comment.
> * Same-repo and fork PRs: one sticky Yetus comment that updates on push.
> h3. Out of scope
> * {{pull_request_target}} that checks out or runs PR code
> * Commenting from master-build.yml
> * Path-filter test selection
--
This message was sent by Atlassian Jira
(v8.20.10#820010)