// Fetches CircleCI job logs via the v1.1 API and displays step-level output. Focuses on failed steps. Use when: CI checks fail on a PR, user shares a CircleCI job URL, user asks to check build logs, 'circleci', 'build failed', 'CI failed', 'check the logs'.
Fetches CircleCI job logs via the v1.1 API and displays step-level output. Focuses on failed steps. Use when: CI checks fail on a PR, user shares a CircleCI job URL, user asks to check build logs, 'circleci', 'build failed', 'CI failed', 'check the logs'.
Fetching CircleCI Logs
Fetch step-level build logs from CircleCI jobs using the v1.1 API.
When to use
PR checks failed and you need to see why
User shares a CircleCI URL (e.g. https://circleci.com/gh/org/repo/169955)
User asks to investigate a CI failure
Extract job details from URL
CircleCI URLs follow this pattern:
https://circleci.com/gh/{org}/{repo}/{job_number}
Extract org, repo, and job_number from the URL. If the user provides only a job number, ask for the org/repo or check the current git remote:
git remote get-url origin | sed -E 's|.*github\.com[:/]([^/]+)/([^/.]+).*|\1/\2|'