@@ -72,38 +72,65 @@ if git rev-parse "$new_version" >/dev/null 2>&1; then
7272fi
7373
7474# Verify the commit has been signed off (via GitHub Actions check run)
75+ # Polls until signoff passes, fails, or times out
7576echo " "
7677echo " Verifying commit signoff..."
7778COMMIT_SHA=$( git rev-parse origin/main)
79+ COMMIT_SHORT=$( git rev-parse --short origin/main)
80+
81+ MAX_ATTEMPTS=60 # 10 minutes max (60 * 10 seconds)
82+ ATTEMPT=1
83+
84+ while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
85+ # GitHub Actions creates "check runs", not "commit statuses" - use the check-runs API
86+ CHECK_RUNS=$( gh api \
87+ -H " Accept: application/vnd.github+json" \
88+ -H " X-GitHub-Api-Version: 2022-11-28" \
89+ " /repos/sequinstream/sequin/commits/$COMMIT_SHA /check-runs" 2> /dev/null || echo ' {"check_runs":[]}' )
90+
91+ SIGNOFF_SUCCESS=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .conclusion=="success")] | length' )
92+ SIGNOFF_FAILED=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .conclusion=="failure")] | length' )
93+ SIGNOFF_PENDING=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="in_progress")] | length' )
94+ SIGNOFF_QUEUED=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="queued")] | length' )
95+
96+ if [ " $SIGNOFF_SUCCESS " -gt 0 ]; then
97+ echo -e " ${GREEN} ✓ Commit $COMMIT_SHORT has been signed off${RESET} "
98+ break
99+ elif [ " $SIGNOFF_FAILED " -gt 0 ]; then
100+ echo -e " ${RED} ✗ Signoff failed for commit $COMMIT_SHORT ${RESET} "
101+ echo " Check the workflow run: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
102+ exit 1
103+ elif [ " $SIGNOFF_PENDING " -gt 0 ] || [ " $SIGNOFF_QUEUED " -gt 0 ]; then
104+ if [ $ATTEMPT -eq 1 ]; then
105+ echo -e " ${YELLOW} ⏳ Signoff is running for commit $COMMIT_SHORT , waiting...${RESET} "
106+ fi
107+ printf " ."
108+ sleep 10
109+ ATTEMPT=$(( ATTEMPT + 1 ))
110+ else
111+ # No signoff check found yet - might not have started
112+ if [ $ATTEMPT -eq 1 ]; then
113+ echo -e " ${YELLOW} ⏳ Waiting for signoff workflow to start...${RESET} "
114+ fi
115+ printf " ."
116+ sleep 10
117+ ATTEMPT=$(( ATTEMPT + 1 ))
118+ fi
119+ done
78120
79- # GitHub Actions creates "check runs", not "commit statuses" - use the check-runs API
80- CHECK_RUNS=$( gh api \
81- -H " Accept: application/vnd.github+json" \
82- -H " X-GitHub-Api-Version: 2022-11-28" \
83- " /repos/sequinstream/sequin/commits/$COMMIT_SHA /check-runs" 2> /dev/null || echo ' {"check_runs":[]}' )
84-
85- SIGNOFF_SUCCESS=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .conclusion=="success")] | length' )
86- SIGNOFF_PENDING=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="in_progress")] | length' )
87- SIGNOFF_QUEUED=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="queued")] | length' )
88-
89- if [ " $SIGNOFF_SUCCESS " -gt 0 ]; then
90- echo -e " ${GREEN} ✓ Commit has been signed off${RESET} "
91- elif [ " $SIGNOFF_PENDING " -gt 0 ] || [ " $SIGNOFF_QUEUED " -gt 0 ]; then
92- echo -e " ${YELLOW} ⏳ Signoff is still running. Please wait for it to complete.${RESET} "
93- echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
94- exit 1
95- else
96- echo -e " ${RED} ✗ Commit has not been signed off.${RESET} "
121+ # Check if we exited the loop due to timeout
122+ if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
97123 echo " "
98- echo " This could mean:"
99- echo " 1. The signoff workflow hasn't started yet (wait a moment)"
100- echo " 2. The signoff workflow failed (check GitHub Actions)"
101- echo " 3. This commit was never pushed to main"
102- echo " "
103- echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
124+ echo -e " ${RED} ✗ Timeout waiting for signoff (10 minutes)${RESET} "
125+ echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
104126 exit 1
105127fi
106128
129+ # Add newline after dots
130+ if [ $ATTEMPT -gt 1 ]; then
131+ echo " "
132+ fi
133+
107134# Show what will happen
108135echo " "
109136echo -e " ${CYAN} This will:${RESET} "
0 commit comments