This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch ci/fix-component-test-sha-check
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 45271409ef54a8ec6dcdfc2b655633bfcdd989dd
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Mar 10 11:16:54 2026 +0100

    chore(ci): fix /component-test sha check using head commit date
    
    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.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .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