This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 20b61c68a9ba chore(ci): post tested modules comment on PRs (#21957)
20b61c68a9ba is described below
commit 20b61c68a9ba2b383b44c1caf1e1689374a02edd
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Mar 12 15:50:11 2026 +0100
chore(ci): post tested modules comment on PRs (#21957)
The incremental build already writes tested modules to the GitHub
Actions step summary, but that's only visible in the Actions UI.
This change also posts (and updates) a PR comment listing which
modules were actually tested by CI, similar to what /component-test
already does.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../actions/incremental-build/incremental-build.sh | 16 +++++++-
.github/workflows/pr-build-main.yml | 45 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/.github/actions/incremental-build/incremental-build.sh
b/.github/actions/incremental-build/incremental-build.sh
index 681f73034c6c..b7f600fdf30d 100755
--- a/.github/actions/incremental-build/incremental-build.sh
+++ b/.github/actions/incremental-build/incremental-build.sh
@@ -168,12 +168,17 @@ function main() {
fi
fi
- # Write the list of tested modules to the step summary
+ # Write the list of tested modules to the step summary and PR comment file
+ local comment_file="incremental-${mode}-comment.md"
if [[ -n "$pl" && ${buildAll} != "true" ]] ; then
echo "### Changed modules" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
+ echo "<!-- ci-tested-modules -->" > "$comment_file"
+ echo ":test_tube: **CI tested the following changed modules:**" >>
"$comment_file"
+ echo "" >> "$comment_file"
for w in $(echo "$pl" | tr ',' '\n'); do
echo "- \`$w\`" >> "$GITHUB_STEP_SUMMARY"
+ echo "- \`$w\`" >> "$comment_file"
done
echo "" >> "$GITHUB_STEP_SUMMARY"
# Extract full reactor module list from the build log
@@ -185,14 +190,23 @@ function main() {
count=$(echo "$reactor_modules" | wc -l | tr -d ' ')
echo "<details><summary><b>All tested modules ($count)</b></summary>"
>> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
+ echo "" >> "$comment_file"
+ echo "<details><summary>Full reactor ($count modules)</summary>" >>
"$comment_file"
+ echo "" >> "$comment_file"
echo "$reactor_modules" | while read -r m; do
echo "- $m" >> "$GITHUB_STEP_SUMMARY"
+ echo "- $m" >> "$comment_file"
done
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
+ echo "" >> "$comment_file"
+ echo "</details>" >> "$comment_file"
fi
fi
+ elif [[ ${buildAll} = "true" ]] ; then
+ echo "<!-- ci-tested-modules -->" > "$comment_file"
+ echo ":information_source: CI did not run targeted module tests (all
projects built or tests skipped)." >> "$comment_file"
fi
if [[ ${ret} -ne 0 ]] ; then
diff --git a/.github/workflows/pr-build-main.yml
b/.github/workflows/pr-build-main.yml
index 9710aba414f4..4be82e9f0475 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -96,6 +96,51 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-mvnd-install: 'true'
artifact-upload-suffix: java-${{ matrix.java }}
+ - name: Post CI test summary comment
+ if: always() && !matrix.experimental
+ uses: actions/github-script@v8
+ with:
+ script: |
+ const fs = require('fs');
+ const commentFile = 'incremental-test-comment.md';
+ if (!fs.existsSync(commentFile)) return;
+ const body = fs.readFileSync(commentFile, 'utf8').trim();
+ if (!body) return;
+
+ const prNumber = ${{ github.event.number || inputs.pr_number || 0
}};
+ if (!prNumber) {
+ core.warning('Could not determine PR number, skipping test
summary comment');
+ return;
+ }
+
+ const marker = '<!-- ci-tested-modules -->';
+
+ try {
+ const { data: comments } = await
github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ });
+ const existing = comments.find(c => c.body &&
c.body.includes(marker));
+
+ if (existing) {
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: existing.id,
+ body: body,
+ });
+ } else {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: prNumber,
+ body: body,
+ });
+ }
+ } catch (error) {
+ core.warning(`Failed to post CI test summary comment:
${error.message}`);
+ }
- name: mvn test parent pom dependencies changed
uses: ./.github/actions/detect-dependencies
with: