This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch ci/improve-component-test-comments in repository https://gitbox.apache.org/repos/asf/camel.git
commit bbf972babb109af5931c5d324cbf1490161846b7 Author: Guillaume Nodet <[email protected]> AuthorDate: Tue Mar 10 11:55:29 2026 +0100 chore(ci): improve /component-test feedback comments - React with thumbs-up on the trigger comment instead of posting a separate "robot will run tests" comment - Post test results as new comments on the PR instead of editing the original /component-test comment - Add workflow-level failure comment for early failures (sha check, checkout, setup) that occur before the action runs - Fix checkout ref: use steps.pr.outputs.pr_sha instead of env.pr_sha which was never set as an env var - Fix hardcoded apache/camel in failure URL to use github.repository --- .github/actions/component-test/action.yaml | 21 ++++++--------------- .github/workflows/pr-manual-component-test.yml | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/actions/component-test/action.yaml b/.github/actions/component-test/action.yaml index b65d245ac4e9..6845c3ca6115 100644 --- a/.github/actions/component-test/action.yaml +++ b/.github/actions/component-test/action.yaml @@ -24,9 +24,6 @@ inputs: pr-id: description: 'Id of the pull request to update' required: true - comment-id: - description: 'Id of the comment to process' - required: true comment-body: description: 'Body of the comment to process' required: true @@ -68,22 +65,16 @@ runs: name: tests-${{ inputs.artifact-upload-suffix }}.log path: tests.log - name: Success comment - if: success() + if: success() uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 with: - comment-id: ${{ inputs.comment-id }} - edit-mode: replace + issue-number: ${{ inputs.pr-id }} body: | - ${{ inputs.comment-body }} - - **Result** :white_check_mark: The tests passed successfully + :white_check_mark: `${{ inputs.comment-body }}` tests passed successfully. - name: Failure comment - if: failure() + if: failure() uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 with: - comment-id: ${{ inputs.comment-id }} - edit-mode: replace + issue-number: ${{ inputs.pr-id }} body: | - ${{ inputs.comment-body }} - - **Result** :x: The tests failed please [check the logs](https://github.com/apache/camel/actions/runs/${{ inputs.run-id }}) + :x: `${{ inputs.comment-body }}` tests failed. Please [check the logs](https://github.com/${{ github.repository }}/actions/runs/${{ inputs.run-id }}). diff --git a/.github/workflows/pr-manual-component-test.yml b/.github/workflows/pr-manual-component-test.yml index e73cd6bb8a78..8e36010858f0 100644 --- a/.github/workflows/pr-manual-component-test.yml +++ b/.github/workflows/pr-manual-component-test.yml @@ -61,15 +61,16 @@ jobs: exit 1 fi echo "pr_sha=$head_sha" >> $GITHUB_OUTPUT + - name: React to comment + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + run: | + gh api /repos/${GH_REPO}/issues/comments/${{ github.event.comment.id }}/reactions -f content="+1" - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - ref: ${{ env.pr_sha }} + ref: ${{ steps.pr.outputs.pr_sha }} submodules: recursive - - uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 - with: - issue-number: ${{ github.event.issue.number }} - body: | - :robot: The Apache Camel test robot will run the tests for you :+1: - id: install-packages uses: ./.github/actions/install-packages - name: Set up JDK ${{ matrix.java }} @@ -86,6 +87,12 @@ jobs: with: run-id: ${{ github.run_id }} pr-id: ${{ github.event.issue.number }} - comment-id: ${{ github.event.comment.id }} comment-body: ${{ env.comment_body }} artifact-upload-suffix: java-${{ matrix.java }} + - name: Post failure comment + if: failure() && steps.test.outcome != 'failure' + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 + with: + issue-number: ${{ github.event.issue.number }} + body: | + :x: The `/component-test` run failed. Please [check the logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
