@@ -23,6 +23,16 @@ GREEN='\033[0;32m'
2323CYAN=' \033[0;36m'
2424RESET=' \033[0m'
2525
26+ # Parse arguments
27+ SKIP_SIGNOFF=false
28+ while [[ " $# " -gt 0 ]]; do
29+ case $1 in
30+ --no-signoff) SKIP_SIGNOFF=true ;;
31+ * ) echo " Unknown parameter: $1 " ; exit 1 ;;
32+ esac
33+ shift
34+ done
35+
2636# Set the working directory to the project root
2737cd " $( dirname " $0 " ) /.." || exit
2838
7383
7484# Verify the commit has been signed off (via GitHub Actions check run)
7585# Polls until signoff passes, fails, or times out
76- echo " "
77- echo " Verifying commit signoff..."
7886COMMIT_SHA=$( git rev-parse origin/main)
7987COMMIT_SHORT=$( git rev-parse --short origin/main)
8088
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} "
89+ if [ " $SKIP_SIGNOFF " = true ]; then
90+ echo " "
91+ echo -e " ${YELLOW} ⚠️ Skipping signoff check (--no-signoff)${RESET} "
92+ else
93+ echo " "
94+ echo " Verifying commit signoff..."
95+
96+ MAX_ATTEMPTS=60 # 10 minutes max (60 * 10 seconds)
97+ ATTEMPT=1
98+
99+ while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
100+ # GitHub Actions creates "check runs", not "commit statuses" - use the check-runs API
101+ CHECK_RUNS=$( gh api \
102+ -H " Accept: application/vnd.github+json" \
103+ -H " X-GitHub-Api-Version: 2022-11-28" \
104+ " /repos/sequinstream/sequin/commits/$COMMIT_SHA /check-runs" 2> /dev/null || echo ' {"check_runs":[]}' )
105+
106+ SIGNOFF_SUCCESS=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .conclusion=="success")] | length' )
107+ SIGNOFF_FAILED=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .conclusion=="failure")] | length' )
108+ SIGNOFF_PENDING=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="in_progress")] | length' )
109+ SIGNOFF_QUEUED=$( echo " $CHECK_RUNS " | jq ' [.check_runs[] | select(.name=="signoff" and .status=="queued")] | length' )
110+
111+ if [ " $SIGNOFF_SUCCESS " -gt 0 ]; then
112+ echo -e " ${GREEN} ✓ Commit $COMMIT_SHORT has been signed off${RESET} "
113+ break
114+ elif [ " $SIGNOFF_FAILED " -gt 0 ]; then
115+ echo -e " ${RED} ✗ Signoff failed for commit $COMMIT_SHORT ${RESET} "
116+ echo " Check the workflow run: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
117+ exit 1
118+ elif [ " $SIGNOFF_PENDING " -gt 0 ] || [ " $SIGNOFF_QUEUED " -gt 0 ]; then
119+ if [ $ATTEMPT -eq 1 ]; then
120+ echo -e " ${YELLOW} ⏳ Signoff is running for commit $COMMIT_SHORT , waiting...${RESET} "
121+ fi
122+ printf " ."
123+ sleep 10
124+ ATTEMPT=$(( ATTEMPT + 1 ))
125+ else
126+ # No signoff check found yet - might not have started
127+ if [ $ATTEMPT -eq 1 ]; then
128+ echo -e " ${YELLOW} ⏳ Waiting for signoff workflow to start...${RESET} "
129+ fi
130+ printf " ."
131+ sleep 10
132+ ATTEMPT=$(( ATTEMPT + 1 ))
114133 fi
115- printf " ."
116- sleep 10
117- ATTEMPT=$(( ATTEMPT + 1 ))
118- fi
119- done
134+ done
120135
121- # Check if we exited the loop due to timeout
122- if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
123- echo " "
124- echo -e " ${RED} ✗ Timeout waiting for signoff (10 minutes)${RESET} "
125- echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
126- exit 1
127- fi
136+ # Check if we exited the loop due to timeout
137+ if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
138+ echo " "
139+ echo -e " ${RED} ✗ Timeout waiting for signoff (10 minutes)${RESET} "
140+ echo " Check status at: https://github.com/sequinstream/sequin/commit/$COMMIT_SHA "
141+ exit 1
142+ fi
128143
129- # Add newline after dots
130- if [ $ATTEMPT -gt 1 ]; then
131- echo " "
144+ # Add newline after dots
145+ if [ $ATTEMPT -gt 1 ]; then
146+ echo " "
147+ fi
132148fi
133149
134150# Show what will happen
0 commit comments