Build/Test Tools: Output relevant URLs in GitHub Actions logs - #11223
Build/Test Tools: Output relevant URLs in GitHub Actions logs#11223ArkaPrabhaChowdhury wants to merge 3 commits into
Conversation
|
Hi @ArkaPrabhaChowdhury! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Assigning myself to take a look. |
|
Thanks for this. 3 changes would make it ready for review again:
Once those are in and the branch is rebased on trunk, ping us and we will take another look. |
9d257a8 to
9379261
Compare
|
Hi @lancewillett, Thanks for the feedback. I have addressed the issues. Please do take another look. Thanks! |
adimoldovan
left a comment
There was a problem hiding this comment.
Thanks @ArkaPrabhaChowdhury, the three earlier points are all addressed. A few more, all about the log lines themselves.
|
|
||
| // Update all matched pull requests. | ||
| for (const prNumber of prNumbers) { | ||
| core.notice(`Closed pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`); |
There was a problem hiding this comment.
This says "Closed" before the comment and close calls below run. If either call fails, the PR stays open and the run summary still says it was closed. Move the notice after pulls.update, or at least make the wording honest:
| core.notice(`Closed pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`); | |
| core.notice(`Closing pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${prNumber}`); |
| core.notice(`Created Playground comment for pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${issue_number}`); | ||
| github.rest.issues.createComment( commentInfo ); |
There was a problem hiding this comment.
"Created" is logged before the comment exists, and the create call is not awaited, so a failed call leaves a log that claims a comment that is not there. pr.data.html_url is already in scope, so the URL does not need to be built by hand.
| core.notice(`Created Playground comment for pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${issue_number}`); | |
| github.rest.issues.createComment( commentInfo ); | |
| await github.rest.issues.createComment( commentInfo ); | |
| core.notice( `Created Playground comment for pull request: ${ pr.data.html_url }` ); |
| core.notice(`Created missing Trac ticket comment for pull request: https://github.com/${owner}/${repo}/pull/${number}`); | ||
| github.rest.issues.createComment( { |
There was a problem hiding this comment.
Same problem: "Created" is logged before the create call, which is not awaited. pr.html_url is already in scope.
| core.notice(`Created missing Trac ticket comment for pull request: https://github.com/${owner}/${repo}/pull/${number}`); | |
| github.rest.issues.createComment( { | |
| core.notice( `Creating missing Trac ticket comment for pull request: ${ pr.html_url }` ); | |
| await github.rest.issues.createComment( { |
| for (const ticket of fixedList) { | ||
| core.notice(`Ticket: https://core.trac.wordpress.org/ticket/${ticket}`); | ||
| } | ||
| core.notice(`SVN changeset: https://core.trac.wordpress.org/changeset/${svnRevisionNumber}`); |
There was a problem hiding this comment.
These run only after the whole search loop, so a run that fails during the GraphQL search logs no ticket or changeset at all. The loop at line 60 already builds tracTicketUrl: log the ticket there, and log the changeset before the search starts.
| This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.`; | ||
|
|
||
| for (const ticket of fixedList) { | ||
| core.notice(`Ticket: https://core.trac.wordpress.org/ticket/${ticket}`); |
There was a problem hiding this comment.
core.notice() makes an annotation, and GitHub shows at most 10 per step. One per ticket, one per changeset and one per closed PR in this single step means a commit that closes many PRs loses the last links from the summary. Use core.info() for the per-item lines (as pull-request-comments.yml already does) and keep one headline core.notice().
| // Update all matched pull requests. | ||
| for (const prNumber of prNumbers) { |
There was a problem hiding this comment.
Two small things on this loop. When no PR matches, the run says nothing, so a reader cannot tell "nothing to close" from "loop never ran". And prNumbers can hold the same PR twice when a commit fixes two tickets that one PR references, which now also repeats the notice.
| // Update all matched pull requests. | |
| for (const prNumber of prNumbers) { | |
| const uniquePrNumbers = [...new Set(prNumbers)]; | |
| core.info(`Found ${uniquePrNumbers.length} pull request(s) to close.`); | |
| // Update all matched pull requests. | |
| for (const prNumber of uniquePrNumbers) { |
| return; | ||
| } | ||
|
|
||
| core.notice(`Rerunning workflow run: ${workflow_run.data.html_url}`); |
There was a problem hiding this comment.
The early return still logs nothing, so a second-attempt run is green with an empty log, which is the no-context case in the ticket. The run data already has the name and branch, so log them too.
| return; | |
| } | |
| core.notice(`Rerunning workflow run: ${workflow_run.data.html_url}`); | |
| core.info(`Skipping rerun, attempt ${workflow_run.data.run_attempt}: ${workflow_run.data.html_url}`); | |
| return; | |
| } | |
| core.notice(`Rerunning workflow run "${workflow_run.data.name}" on ${workflow_run.data.head_branch}: ${workflow_run.data.html_url}`); |
| - name: Output PR link | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| with: | ||
| script: | | ||
| core.notice(`Pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${context.issue.number}`); |
There was a problem hiding this comment.
This boots a whole Node step to echo one string. A plain run step does the same, and the event payload already has the URL for every trigger this job accepts.
| - name: Output PR link | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| core.notice(`Pull request: https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${context.issue.number}`); | |
| - name: Output PR link | |
| env: | |
| PR_URL: ${{ github.event.pull_request.html_url || github.event.issue.html_url }} | |
| run: echo "::notice::Pull request: $PR_URL" |
9379261 to
eccefd5
Compare
|
Hi @adimoldovan, Thanks for the detailed review. Helps a lot to understand the flow in-depth. I have addressed the issues. Thanks! |
adimoldovan
left a comment
There was a problem hiding this comment.
Thanks for addressing all the raised issues @ArkaPrabhaChowdhury.
It looks good to land for me.
Log the workflow run, pull request, Trac ticket, and SVN changeset URLs handled by the automation workflows. Report skipped reruns and empty pull request searches, and avoid processing the same pull request more than once. Await comment creation so failures are reported and success notices reflect completed requests. Developed in: #11223 Props arkaprabhachowdhury, adrianmoldovanwp, desrosj. Fixes #64299. git-svn-id: https://develop.svn.wordpress.org/trunk@63583 602fd350-edb4-49c9-b593-d223f7449a82
|
Thanks, @ArkaPrabhaChowdhury Arkaprabha, for sticking with your first |
Log the workflow run, pull request, Trac ticket, and SVN changeset URLs handled by the automation workflows. Report skipped reruns and empty pull request searches, and avoid processing the same pull request more than once. Await comment creation so failures are reported and success notices reflect completed requests. Developed in: WordPress/wordpress-develop#11223 Props arkaprabhachowdhury, adrianmoldovanwp, desrosj. Fixes #64299. Built from https://develop.svn.wordpress.org/trunk@63583 git-svn-id: http://core.svn.wordpress.org/trunk@62759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
I have added core.notice() logging to output the relevant URLs for Trac tickets, PRs, and SVN logs to the workflows mentioned in #64299.
Because these workflows run on pull_request_target and workflow_run events, GitHub enforces running the trunk version of the workflow files, so I was unable to test the live output of these changes in this PR.
Let me know if you need any adjustments!
Use of AI Tools
Tools: Google Antigravity for basic suggestions and confirmation. Final implementation were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
Trac ticket: https://core.trac.wordpress.org/ticket/64299
Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5
Used for: Reviewing the Trac ticket and relevant code, helping with the initial implementation and regression-test approach, and assisting with validation and PR-description drafting. The final implementation, tests, validation results, and description were reviewed and accepted by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.