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 5346f4ec08f6 chore(ci): fix /component-test sha check using head 
commit date (#21903)
5346f4ec08f6 is described below

commit 5346f4ec08f62ff92114ee4e7416a7e94624cdd1
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Mar 10 11:43:30 2026 +0100

    chore(ci): fix /component-test sha check using head commit date (#21903)
    
    The "Retrieve sha" step was comparing `head.repo.pushed_at` (the
    repo-level last push timestamp) with the comment creation time.
    Any push to the repository (e.g., merging another PR to main) after
    the comment would cause this check to fail, even though the PR branch
    itself hadn't changed.
    
    Fix by comparing the PR's head commit date instead, which accurately
    reflects when the PR branch was last updated.
---
 .github/workflows/pr-manual-component-test.yml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/pr-manual-component-test.yml 
b/.github/workflows/pr-manual-component-test.yml
index ef88b148f140..e73cd6bb8a78 100644
--- a/.github/workflows/pr-manual-component-test.yml
+++ b/.github/workflows/pr-manual-component-test.yml
@@ -51,8 +51,13 @@ jobs:
         run: |
           pr="$(gh api /repos/${GH_REPO}/pulls/${PR_NUMBER})"
           head_sha="$(echo "$pr" | jq -r .head.sha)"
-          pushed_at="$(echo "$pr" | jq -r .head.repo.pushed_at)"
-          if [[ $(date -d "$pushed_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) 
]]; then
+          # Check that the PR branch was not pushed to after the comment was 
created.
+          # Use the head commit date (not head.repo.pushed_at which is 
repo-level
+          # and changes whenever any branch is pushed, causing false 
negatives).
+          commit="$(gh api /repos/${GH_REPO}/commits/${head_sha})"
+          committed_at="$(echo "$commit" | jq -r .commit.committer.date)"
+          if [[ $(date -d "$committed_at" +%s) -gt $(date -d "$COMMENT_AT" 
+%s) ]]; then
+              echo "PR branch was updated after the comment was posted 
(commit: $committed_at, comment: $COMMENT_AT). Aborting."
               exit 1
           fi
           echo "pr_sha=$head_sha" >> $GITHUB_OUTPUT

Reply via email to