-
Notifications
You must be signed in to change notification settings - Fork 122
feat: add PR CI watch skill #2447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| applyTo: ".github/skills/pr-ci-watch-subagent/**/*" | ||
| --- | ||
|
|
||
| When maintaining the PR CI watch skill, keep the workflow centered on a subagent that waits on `gh pr checks <pr> --watch` and only returns once CI reaches a terminal success or failure state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| --- | ||
| name: pr-ci-watch-subagent | ||
| description: Use this skill whenever you have just created a GitHub pull request with `gh pr create`, or the user asks you to monitor PR CI / checks / workflows until they finish. This skill teaches you to launch a subagent that uses the GitHub CLI watch capability to wait for CI completion and report a final pass/fail result back to the main agent instead of polling manually. | ||
| --- | ||
|
|
||
| # PR CI Watch Subagent | ||
|
|
||
| Use this skill immediately after creating a GitHub pull request when CI status matters. | ||
| The goal is to keep the main agent free while a subagent waits on GitHub checks. | ||
|
|
||
| ## When to use | ||
|
|
||
| Use this skill when any of these are true: | ||
|
|
||
| - You just ran `gh pr create` and need to know whether CI passes. | ||
| - The user asks you to watch PR checks, CI, workflows, or GitHub status until completion. | ||
| - You need a blocking wait for GitHub checks but do not want the main agent to idle. | ||
|
|
||
| ## Core behavior | ||
|
|
||
| 1. Capture the PR identifier right after PR creation. | ||
| 2. Start a subagent dedicated to CI monitoring. | ||
| 3. In that subagent, use `gh` watch-style behavior to wait for the PR checks to finish. | ||
| 4. Return control to the main agent only when CI reaches a terminal state: | ||
| - success / all required checks passed | ||
| - failure / any check failed | ||
| 5. Report a concise final summary that includes the PR reference and the terminal CI outcome. | ||
|
|
||
| ## Implementation pattern | ||
|
|
||
| ### Main agent | ||
|
|
||
| After `gh pr create`, obtain one of the following: | ||
|
|
||
| - PR URL | ||
| - PR number | ||
| - current branch when it unambiguously maps to the PR | ||
|
|
||
| Then launch a subagent with a prompt like: | ||
|
|
||
| ```text | ||
| Monitor GitHub PR CI until completion. | ||
|
|
||
| Inputs: | ||
| - PR: <url-or-number> | ||
| - Repository root: <repo-path> | ||
|
|
||
| Requirements: | ||
| - Use the GitHub CLI. | ||
| - Prefer the built-in watch behavior rather than manual polling. | ||
| - Wait until checks reach a terminal state. | ||
| - Return only after CI succeeds or fails. | ||
| - Final response must state whether CI passed or failed and include any failing check names if available. | ||
| ``` | ||
|
|
||
| ### Subagent | ||
|
|
||
| The subagent should: | ||
|
|
||
| 1. Resolve the PR reference if needed. | ||
| 2. Run a GitHub CLI command that blocks until checks complete. | ||
| 3. Inspect the final status. | ||
| 4. Return a short result to the main agent. | ||
|
|
||
| Preferred command pattern: | ||
|
|
||
| ```bash | ||
| gh pr checks <pr> --watch | ||
| ``` | ||
|
|
||
| If the CLI output supports the exit code semantics in the current environment, use them to determine success vs failure. If not, read the final output carefully and summarize the terminal state. | ||
|
|
||
| ## Reporting contract | ||
|
|
||
| The subagent's final message should use this structure: | ||
|
|
||
| ```text | ||
| PR: <pr-url-or-number> | ||
| CI result: passed|failed | ||
| Summary: <one sentence> | ||
| Failed checks: <comma-separated names or "none"> | ||
| ``` | ||
|
|
||
| Keep the result brief. The main agent can expand on it for the user if needed. | ||
|
|
||
| ## Important notes | ||
|
|
||
| - Prefer `gh pr checks <pr> --watch` over ad hoc sleep loops because it is simpler and better aligned with GitHub CLI behavior. | ||
| - Do not claim CI passed until the watch command reaches a terminal state. | ||
| - If authentication or repository resolution fails, return that error clearly instead of guessing. | ||
| - If the PR has no checks, report that explicitly so the main agent can decide whether that is acceptable. | ||
|
|
||
| ## Example main-agent flow | ||
|
|
||
| 1. Create PR with `gh pr create`. | ||
| 2. Extract the returned PR URL. | ||
| 3. Launch the CI-watch subagent with that URL. | ||
| 4. Wait for the subagent result. | ||
| 5. Tell the user whether CI passed or failed. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The skill defines success as "all required checks passed," but the recommended command
gh pr checks <pr> --watchwatches all checks by default. In repositories with optional checks, a non-required failure will be reported as CI failure even when required branch-protection checks are green, so the main agent can incorrectly tell users the PR failed. Either add--requiredto the watch command or change the documented success criteria to match all checks.Useful? React with 👍 / 👎.