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

Fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-java.git


The following commit(s) were added to refs/heads/master by this push:
     new 8000e2344 Fix: Prepare RC check (#3762)
8000e2344 is described below

commit 8000e2344d3df58ca9507e1167fd2c3fb041e15d
Author: Russell Spitzer <[email protected]>
AuthorDate: Thu Sep 3 13:02:12 2026 -0500

    Fix: Prepare RC check (#3762)
    
    * Prepare RC: exclude release-process workflows from CI verification
    
    check_github_checks_passed queried the check-runs API and counted the 
currently-executing "Prepare Release Candidate" job as an incomplete check, so 
the step always failed with dry_run=false. Switch to the workflow-runs API and 
filter out any workflow whose path starts with .github/workflows/release-, so 
this run's self-reference and any historical release-process attempts on the 
same commit are ignored while real code CI (ci-hadoop3, vector-plugins, 
ci-release-scripts) is still enforced.
    
    Co-Authored-By: Claude Opus 4.7 <[email protected]>
    
    * Update github.bats tests for workflow-runs API
    
    Rewrites the "still running" and "failed conclusion" tests around the
    workflow-runs mock shape, and adds three tests covering the release-*.yml
    filter: in-progress self-reference is ignored, historical failed release
    runs on the same commit are ignored, and real CI failures are still
    detected when release workflows are mixed in.
    
    Co-Authored-By: Claude Opus 4.7 <[email protected]>
    
    * Trim release-filter tests to a single combined case
    
    Drop the two separate "ignores release-*.yml" tests and keep one test
    that exercises both the filter and the failure detection: a release
    workflow in-progress alongside a failed CI workflow.
    
    Co-Authored-By: Claude Opus 4.7 <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.7 <[email protected]>
---
 release/libs/_github.sh   | 27 +++++++++++-----------
 release/tests/github.bats | 58 +++++++++++++++++++++++++++++++----------------
 2 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/release/libs/_github.sh b/release/libs/_github.sh
index 050aa305a..12b5c848a 100644
--- a/release/libs/_github.sh
+++ b/release/libs/_github.sh
@@ -44,31 +44,32 @@ function check_github_checks_passed() {
 
   local repo_info="${GITHUB_REPO}"
 
-  local num_incomplete
-  if ! num_incomplete=$(gh api 
"repos/${repo_info}/commits/${commit_sha}/check-runs" \
-    --jq '[.check_runs[] | select(.status != "completed")] | length'); then
-    print_error "Failed to fetch GitHub check runs for commit ${commit_sha}"
+  local runs_json
+  if ! runs_json=$(gh api 
"repos/${repo_info}/actions/runs?head_sha=${commit_sha}&per_page=100"); then
+    print_error "Failed to fetch GitHub workflow runs for commit ${commit_sha}"
     return 1
   fi
 
+  # Exclude release-*.yml workflows.
+  local ci_runs
+  ci_runs=$(echo "${runs_json}" \
+    | jq '[.workflow_runs[] | select((.path // "") | 
startswith(".github/workflows/release-") | not)]')
+
+  local num_incomplete
+  num_incomplete=$(echo "${ci_runs}" | jq '[.[] | select(.status != 
"completed")] | length')
+
   if [[ ${num_incomplete} -ne 0 ]]; then
     print_error "Found ${num_incomplete} still-running GitHub checks for 
commit ${commit_sha}"
-    gh api "repos/${repo_info}/commits/${commit_sha}/check-runs" \
-      --jq '.check_runs[] | select(.status != "completed") | "  - \(.name): 
\(.status)"' >&2
+    echo "${ci_runs}" | jq -r '.[] | select(.status != "completed") | "  - 
\(.name): \(.status)"' >&2
     return 1
   fi
 
   local num_failed
-  if ! num_failed=$(gh api 
"repos/${repo_info}/commits/${commit_sha}/check-runs" \
-    --jq '[.check_runs[] | select(.conclusion != "success" and .conclusion != 
"skipped")] | length'); then
-    print_error "Failed to fetch GitHub check runs for commit ${commit_sha}"
-    return 1
-  fi
+  num_failed=$(echo "${ci_runs}" | jq '[.[] | select(.conclusion != "success" 
and .conclusion != "skipped")] | length')
 
   if [[ ${num_failed} -ne 0 ]]; then
     print_error "Found ${num_failed} failed GitHub checks for commit 
${commit_sha}"
-    gh api "repos/${repo_info}/commits/${commit_sha}/check-runs" \
-      --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != 
"skipped") | "  - \(.name): \(.conclusion)"' >&2
+    echo "${ci_runs}" | jq -r '.[] | select(.conclusion != "success" and 
.conclusion != "skipped") | "  - \(.name): \(.conclusion)"' >&2
     return 1
   fi
 
diff --git a/release/tests/github.bats b/release/tests/github.bats
index a1500136b..ca69dad2a 100644
--- a/release/tests/github.bats
+++ b/release/tests/github.bats
@@ -54,8 +54,12 @@ setup() {
   DRY_RUN=0
 
   gh() {
-    echo "0"
-    return 0
+    cat <<'JSON'
+{"workflow_runs": [
+  {"name": "CI Hadoop 3",    "path": ".github/workflows/ci-hadoop3.yml",     
"status": "completed", "conclusion": "success"},
+  {"name": "Vector Plugins", "path": ".github/workflows/vector-plugins.yml", 
"status": "completed", "conclusion": "success"}
+]}
+JSON
   }
   export -f gh
 
@@ -69,20 +73,18 @@ setup() {
   DRY_RUN=0
 
   gh() {
-    if [[ "$*" == *"status"* && "$*" == *"length"* ]]; then
-      echo "1"
-    elif [[ "$*" == *"status"* ]]; then
-      echo "  - CI Hadoop 3: in_progress"
-    else
-      echo "0"
-    fi
-    return 0
+    cat <<'JSON'
+{"workflow_runs": [
+  {"name": "CI Hadoop 3", "path": ".github/workflows/ci-hadoop3.yml", 
"status": "in_progress", "conclusion": null}
+]}
+JSON
   }
   export -f gh
 
   run check_github_checks_passed "abc123"
   [ "$status" -eq 1 ]
   [[ "$output" == *"still-running"* ]]
+  [[ "$output" == *"CI Hadoop 3"* ]]
 }
 
 @test "check_github_checks_passed: fails when checks have failed conclusions" {
@@ -90,22 +92,38 @@ setup() {
   DRY_RUN=0
 
   gh() {
-    if [[ "$*" == *"status"* && "$*" == *"length"* ]]; then
-      echo "0"
-    elif [[ "$*" == *"conclusion"* && "$*" == *"length"* ]]; then
-      echo "2"
-    elif [[ "$*" == *"conclusion"* ]]; then
-      echo "  - CI Hadoop 3: failure"
-    else
-      echo "0"
-    fi
-    return 0
+    cat <<'JSON'
+{"workflow_runs": [
+  {"name": "CI Hadoop 3", "path": ".github/workflows/ci-hadoop3.yml", 
"status": "completed", "conclusion": "failure"}
+]}
+JSON
   }
   export -f gh
 
   run check_github_checks_passed "abc123"
   [ "$status" -eq 1 ]
   [[ "$output" == *"failed GitHub checks"* ]]
+  [[ "$output" == *"CI Hadoop 3"* ]]
+}
+
+@test "check_github_checks_passed: ignores release-*.yml runs and still 
catches CI failures" {
+  export GITHUB_TOKEN="fake-token"
+  DRY_RUN=0
+
+  gh() {
+    cat <<'JSON'
+{"workflow_runs": [
+  {"name": "Release - Prepare RC", "path": 
".github/workflows/release-prepare-rc.yml", "status": "in_progress", 
"conclusion": null},
+  {"name": "Vector Plugins",       "path": 
".github/workflows/vector-plugins.yml",     "status": "completed",   
"conclusion": "failure"}
+]}
+JSON
+  }
+  export -f gh
+
+  run check_github_checks_passed "abc123"
+  [ "$status" -eq 1 ]
+  [[ "$output" == *"failed GitHub checks"* ]]
+  [[ "$output" == *"Vector Plugins"* ]]
 }
 
 @test "check_github_checks_passed: fails when gh api errors" {

Reply via email to