check-ci-results
Overview
Check the latest workflow run for a PR and diagnose failures from logs with actionable fix suggestions.
Workflow
- Run
gh pr checks <pr-number>(orgh pr checks <pr-number> --json) to get CI/checks for the PR. - Determine overall CI status from checks (pass/fail/pending/etc.).
- If there are failures, try to obtain a GitHub Actions run ID:
- Prefer extracting it from the
linkfield ingh pr checks --jsonoutput when it points to/actions/runs/<run-id>. - If no run link is available, fall back to listing runs for the PR head branch with
gh run list --branch <headRefName> --event pull_request.
- Prefer extracting it from the
- On failure (and when you have a run ID), run
gh run view <run-id> --log-failed(or--log) to inspect logs. - Summarize root cause and propose concrete fixes.
- Return any follow-up checks needed before rerun.
Command Notes
- Checks for a PR:
gh pr checks <number> | <url> | <branch> [--watch] - Recommended by
gh run listmanual for PR association: usegh pr checks - Head branch name (for fallback):
gh pr view <pr-number> --json headRefName --jq .headRefName - Latest run (fallback):
gh run list --branch <headRefName> --event pull_request --limit 1 --json databaseId,status,conclusion,url,workflowName --jq '.[0]' - Run logs:
gh run view <run-id> --log-failed(orgh run view <run-id> --log)
Output Contract
Return:
- PR number and run ID
- CI status
- For failures: concise "cause", "impact", and "fix"
- Responses should be in Japanese
Converted and distributed by TomeVault — claim your Tome and manage your conversions.