wait-for-ci
Block until CI passes or fails on the current PR
When & Why to Use This Skill
The wait-for-CI skill is a specialized utility designed to monitor and synchronize workflows with GitHub Actions. It blocks execution until Continuous Integration (CI) checks on a specific Pull Request either pass or fail, providing a reliable mechanism for developers and AI agents to ensure code quality before proceeding with subsequent tasks like merging or deployment.
Use Cases
- Automated Pull Request Merging: Integrate this skill into automation scripts to wait for all status checks to pass before automatically triggering a PR merge.
- Continuous Deployment Pipelines: Ensure that deployment workflows only proceed to staging or production environments after the build and test suite has successfully completed.
- Agentic Workflow Synchronization: Enable AI agents to pause task execution while background CI processes are running, preventing premature actions on unverified code changes.
- Efficient Error Handling: Utilize the fail-fast mechanism to immediately stop workflows and notify developers as soon as any CI check fails, saving time and compute resources.
| name | wait-for-CI |
|---|---|
| description | Block until CI passes or fails on the current PR |
Wait for CI
This skill blocks until CI either passes or fails on the current PR using a single blocking command.
Usage
Run this command to block until CI completes:
gh pr checks --watch --fail-fast
This command will:
- Block until all CI checks complete
- Exit with code 0 if all checks pass
- Exit with non-zero code and stop early (
--fail-fast) if any check fails
Handling "no checks" case
If CI hasn't started yet, the command may return immediately with "no checks reported". In that case, wait briefly and retry:
sleep 30 && gh pr checks --watch --fail-fast
If after 2 attempts (about 1 minute total) there are still no checks, one of the following is true:
- You have merge conflicts. Resolve them and then start the CI wait again.
- Your changes are not triggering CI. Check the GitHub Actions setup to confirm nothing will have triggered. If true, you can consider CI green.
- GitHub is having issues. Check status.github.com to verify. If true, bail out and let the user know they'll need to try again when GitHub is back.