Lewis John McGibbney created NUTCH-3219:
-------------------------------------------

             Summary: GitHub Actions JUnit workflow does not comment on pull 
requests from forks
                 Key: NUTCH-3219
                 URL: https://issues.apache.org/jira/browse/NUTCH-3219
             Project: Nutch
          Issue Type: Improvement
          Components: ci/cd
    Affects Versions: 1.23
            Reporter: Lewis John McGibbney
            Assignee: Lewis John McGibbney
             Fix For: 1.24


The {{junit report}} workflow publishes the {{JUnit Test Report}} check for a 
fork pull request, but it does not post the sticky JUnit summary comment.

[PR 974|https://github.com/apache/nutch/pull/974] demonstrates the failure:
 * Head repository: {{lewismc/nutch}}
 * Head SHA: {{a3fe3d831a3b30eb6db4edba37103d378e0fe429}}
 * Parent CI run: [https://github.com/apache/nutch/actions/runs/38175653385]
 * JUnit report run: [https://github.com/apache/nutch/actions/runs/38178099406]
 * Check result: success — 450 tests run, 444 passed, 6 skipped, 0 failed
 * Report log: {{Resolved PR number='' has_pr=''}}
 * The pull request has no {{github-actions[bot]}} JUnit comment.

Same-repository pull requests #972, #975, and #976 receive the comment. Fork 
pull request #971 misses it in the same way.

{{junit-report.yml}} first reads {{{}workflow_run.pull_requests{}}}, then calls 
{{{}GET /repos/apache/nutch/commits/\{sha}/pulls{}}}. For a fork pull request, 
GitHub leaves {{workflow_run.pull_requests}} empty, and the base-repository 
commit endpoint does not list the fork commit. The report action therefore runs 
with {{comment: false}} and {{{}updateComment: false{}}}. It still creates the 
check because the check is attached directly to the head SHA.

NUTCH-3208 added the base-repository commit lookup, which resolves 
same-repository pull requests. The Yetus workflow already handles forks by 
recording {{github.event.pull_request.number}} during the {{pull_request}} job 
and validating it in its {{workflow_run}} companion.

The proposed fix is to record the pull-request number in the existing 
{{junit-test-results-linux-jdk17}} artifact while {{master pull request ci}} 
handles the {{pull_request}} event. The report workflow should use that number 
first, then confirm that the pull request targets {{apache/nutch}} and that its 
current head SHA matches the tested commit before posting the comment. Existing 
lookups remain as fallbacks. If no number passes validation, the workflow 
should still publish the check and skip the comment.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to