Skip to content

Improve CI/CD: labeling, auto-merge, workflow organization, and Python checks #1

Improve CI/CD: labeling, auto-merge, workflow organization, and Python checks

Improve CI/CD: labeling, auto-merge, workflow organization, and Python checks #1

Workflow file for this run

---
name: CI Gate
# This workflow waits for all other checks to complete.
# Use "All Checks Pass" as the single required status check in branch protection.
# This solves the issue where workflows with path filters don't always run.
# yamllint disable-line rule:truthy
on:
pull_request:
push:
branches: [main]
permissions:
checks: read
pull-requests: read
jobs:
gate:
name: All Checks Pass
runs-on: ubuntu-latest
steps:
- name: Wait for all checks to complete
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
CURRENT_JOB: All Checks Pass
run: |
echo "Waiting for all checks on $SHA to complete..."
while true; do
# Get all check runs for this commit
CHECKS=$(gh api "repos/$REPO/commits/$SHA/check-runs" \
--jq '.check_runs | map({name: .name, status: .status, conclusion: .conclusion})')
# Count checks still in progress (excluding this job)
IN_PROGRESS=$(echo "$CHECKS" | jq --arg current "$CURRENT_JOB" \
'[.[] | select(.name != $current and .status != "completed")] | length')
# Check for any failures (excluding this job)
# Conclusion must be success, skipped, or neutral to pass
FAILED=$(echo "$CHECKS" | jq --arg current "$CURRENT_JOB" '
[.[] | select(
.name != $current and
.status == "completed" and
.conclusion != "success" and
.conclusion != "skipped" and
.conclusion != "neutral"
)] | length')
echo "In progress: $IN_PROGRESS, Failed: $FAILED"
if [ "$FAILED" -gt 0 ]; then
echo "::error::One or more checks failed"
echo "$CHECKS" | jq --arg current "$CURRENT_JOB" '
.[] | select(
.name != $current and
.status == "completed" and
.conclusion != "success" and
.conclusion != "skipped" and
.conclusion != "neutral"
)'
exit 1
fi
if [ "$IN_PROGRESS" -eq 0 ]; then
echo "All checks completed successfully!"
break
fi
echo "Waiting 30 seconds..."
sleep 30
done