# Investigate CI Failure

> Investigate CI job failures on a GitHub pull request (checks, Prow, or GitHub Actions). Use when the user pastes a PR URL and asks about CI failures or red checks.

- Skill: `openshift/investigate-ci-failure` (Agent Skill)
- Install (CLI): `npx skillmds@latest add openshift/investigate-ci-failure`
- Raw SKILL.md: https://api.skillmd.com/api/skills/openshift/investigate-ci-failure/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: openshift (https://skillmd.com/u/openshift)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/openshift/investigate-ci-failure

---


# Investigate CI Failure

Default repo: **openshift/lightspeed-agentic-sandbox**. Adjust `org/repo` if the
user gives another URL.

## Workflow

### 1. Extract PR info

```bash
gh api repos/{org}/{repo}/pulls/{pr} --jq '{title, state, user: .user.login, head_sha: .head.sha}'
gh api repos/{org}/{repo}/pulls/{pr}/files --jq '.[].filename'
```

### 2. Get check statuses

```bash
gh pr checks {pr} --repo {org}/{repo}
gh api repos/{org}/{repo}/commits/{head_sha}/check-runs --jq '.check_runs[] | select(.conclusion == "failure") | {name, html_url}'
```

For OpenShift Prow, `gh pr checks` often surfaces Prow job links; use the
**target URL** from failed contexts to open logs.

### 3. Prow / GCS artifacts (when applicable)

From a Prow `target_url` like:

`https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/{org}_{repo}/{pr}/{job_name}/{build_id}`

Derive artifact bases as in the upstream skill (GCS browser + raw `storage.googleapis.com` URLs) and fetch the failing step log (build, unit test, lint).

### 4. Konflux / Tekton

This repo uses Konflux (`.tekton/`). If checks reference Tekton/Konflux:

- Open the failed pipeline run from the GitHub check details.
- Read the failing task log (often `build`, `prefetch-dependencies`, or EC).

### 5. Diagnose

- Classify: dependency prefetch vs lint vs test vs image build.
- Tie failure to a file or command in this repo (Makefile target, `pyproject.toml`, Containerfile).
- Suggest the smallest fix; do not guess — quote the log line.

### 6. Report

- Failed job name(s) + link(s)
- Root cause (one paragraph)
- Concrete next step (file/command)

