fixing-streamlit-ci

작성자: streamlit

현재 브랜치/PR에서 실패한 GitHub Actions CI 작업을 분석하고 수정합니다. CI 검사가 실패하거나, PR 검사에서 오류가 표시되거나, 진단이 필요할 때 사용하세요…

npx skills add https://github.com/streamlit/streamlit --skill fixing-streamlit-ci

Fix CI Failures

Diagnose and fix failed GitHub Actions CI jobs for the current branch/PR using gh CLI and git commands.

When to Use

  • CI checks have failed on a PR
  • You need to understand why a workflow failed
  • You want to apply fixes and verify locally

Workflow

Copy this checklist to track progress:

- [ ] Verify authentication
- [ ] Gather context & find failed jobs
- [ ] Download & analyze logs
- [ ] Present diagnosis to user
- [ ] Apply fix & verify locally
- [ ] Push & recheck CI

1. Verify Authentication

gh auth status

If authentication fails, prompt user to run gh auth login with appropriate scopes.

2. Gather PR Context

# Get PR for current branch
gh pr view --json number,title,url,headRefName

# Get PR description and metadata
gh pr view --json title,body,labels,author

# List changed files
gh pr diff --name-only

# All changes
gh pr diff

3. Check CI Status

# List all checks (shows pass/fail status)
gh pr checks

# Get detailed check info
gh pr checks --json name,state,conclusion,detailsUrl,startedAt,completedAt

# List only failed runs
gh run list --branch $(git branch --show-current) --status failure --limit 10

# Check if CI is still running
gh run list --branch $(git branch --show-current) --status in_progress

4. Find Failed Jobs

# View run details (get RUN_ID from previous step)
gh run view {RUN_ID}

# List failed jobs with IDs
gh run view {RUN_ID} --json jobs --jq '.jobs[] | select(.conclusion == "failure") | {id: .databaseId, name: .name}'

# List failed jobs with their failed steps
gh run view {RUN_ID} --json jobs --jq '.jobs[] | select(.conclusion == "failure") | {name: .name, steps: [.steps[] | select(.conclusion == "failure") | .name]}'

5. Download & Analyze Logs

Primary method:

# Get failed logs (last 250 lines usually contains the error)
gh run view {RUN_ID} --log-failed 2>&1 | tail -250

# Target a specific failed job by ID
gh run view {RUN_ID} --job {JOB_ID} --log-failed 2>&1 | tail -100

Fallback for pending logs:

REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
gh api "/repos/${REPO}/actions/jobs/{JOB_ID}/logs"

Smart log extraction (examples):

# Context around failure markers
gh run view {RUN_ID} --log-failed 2>&1 | grep -B 5 -A 10 -iE "error|fail|exception|traceback|panic|fatal" | head -100

# Python tests - pytest summary
gh run view {RUN_ID} --log-failed 2>&1 | grep -E -A 50 "FAILED|ERROR|short test summary"

# TypeScript/ESLint errors
gh run view {RUN_ID} --log-failed 2>&1 | grep -E -B 2 -A 5 "error TS|error  "

# E2E snapshot mismatches
gh run view {RUN_ID} --log-failed 2>&1 | grep -E -B 2 -A 5 "Missing snapshot for|Snapshot mismatch for"

6. Analyze Failure

Identify:

  • Error type: Lint, type check, test failure, build error
  • Root cause: First/primary error (not cascading failures)
  • Affected files: Which files need changes
  • Error message: Exact error text

Common CI failure categories:

CategoryWorkflowMake CommandAuto-fix
Python lintpython-tests.ymlmake python-lintmake autofix
Python typespython-tests.ymlmake python-types❌ Manual
Python testspython-tests.ymlmake python-tests❌ Manual
Frontend lintjs-tests.ymlmake frontend-lintmake autofix
Frontend typesjs-tests.ymlmake frontend-types❌ Manual
Frontend testsjs-tests.ymlmake frontend-tests❌ Manual
E2E testsplaywright.ymlmake run-e2e-test <file>❌ Manual
E2E snapshotsplaywright.ymlmake run-e2e-test <file>make update-snapshots
NOTICESjs-tests.ymlmake update-noticesmake update-notices
Min constraintspython-tests.ymlmake update-min-depsmake update-min-deps
Pre-commitenforce-pre-commit.ymluv run pre-commit run --all-files✅ Mostly auto-fix
Relative importsensure-relative-imports.ymlCheck script output❌ Manual
PR Labelsrequire-labels.ymlN/A⏭️ Ignore

💡 Quick win: Run make autofix first for lint/formatting failures.

7. Present Diagnosis

For multiple failures, list all and let user choose:

CI Failure Analysis for PR #{NUMBER}: {TITLE}
═══════════════════════════════════════════════════════════════

Found {N} failed jobs/checks:

─────────────────────────────────────────────────────────────────

1. [LINT] Python Unit Tests → Run Linters
   Workflow: python-tests.yml (GitHub Actions)
   Error:    Ruff formatting error in lib/streamlit/elements/foo.py
   Auto-fix: ✅ `make autofix`

2. [TYPE] Javascript Unit Tests → Run type checks
   Workflow: js-tests.yml (GitHub Actions)
   Error:    TS2322: Type 'string' is not assignable to type 'number'
   File:     frontend/lib/src/components/Bar.tsx:42
   Auto-fix: ❌ Manual fix required

─────────────────────────────────────────────────────────────────

Which failures should I address?
Recommended: "1" (auto-fixable)
Options: "1" | "1,2" | "1-2" | "all" | "only auto-fixable"

For single failure, show detailed analysis:

─────────────────────────────────────────────────────────────────
Analyzing: [TYPE] Javascript Unit Tests → Run type checks
─────────────────────────────────────────────────────────────────

Category: TYPE
Workflow: js-tests.yml
Job:      js-unit-tests (ID: 12345678)
Step:     Run type checks

Error snippet:
  frontend/lib/src/components/Bar.tsx:42:5
  error TS2322: Type 'string' is not assignable to type 'number'.

Proposed Fix:
  Change type annotation or fix the value type

─────────────────────────────────────────────────────────────────

Would you like me to:
  [1] Apply the fix automatically
  [2] Show the proposed changes first
  [3] Run local verification only
  [4] Skip this and move to next failure

8. Apply Fix & Verify Locally

After user approval, apply fix and run verification:

# Run all checks (lint, types, tests) on changed files
make check

# Python tests (specific)
uv run pytest lib/tests/path/to/test_file.py::test_name -v

# Frontend tests (specific)
cd frontend && yarn test path/to/test.test.tsx

# E2E tests
make run-e2e-test {test_file.py}

# E2E snapshots
make update-snapshots

9. Summary & Push

git status --short
git diff --stat

Report what failed, what changed, and local verification result.

git add -A
git commit -m "fix: resolve CI failure in {workflow/step}"
git push

10. Recheck CI Status

gh pr checks --watch
# Or re-run failed jobs
gh run rerun {RUN_ID} --failed

Rules

  • Focus on root cause: First error, not cascading failures
  • Minimal fixes: Smallest change that fixes the issue
  • Don't skip tests: Never disable tests to "fix" CI
  • Verify locally: Always run appropriate local command
  • Preserve intent: Understand what code was trying to do

Error Handling

IssueSolution
Auth failedgh auth login with workflow/repo scopes
No PR for branchgh run list to check workflow runs
CI still runninggh pr checks --watch
Logs pendingRetry with job logs API
No failed checksAll passing ✅
Rate limitedWait and retry
Flaky testRe-run: gh run rerun {RUN_ID} --failed

streamlit의 다른 스킬

developing-with-streamlit
streamlit
**[필수]** 모든 Streamlit 작업(Streamlit 애플리케이션 생성, 편집, 디버깅, 미화, 스타일링, 테마 적용, 최적화)에 사용하세요. 또한 필요합니다…
official
addressing-pr-review-comments
streamlit
현재 브랜치의 streamlit/streamlit 저장소에 있는 PR의 모든 유효한 리뷰 코멘트를 처리합니다. 인라인 리뷰 코멘트와 일반 PR(이슈) 코멘트를 모두 포함합니다.
official
checking-changes
streamlit
커밋 전에 포맷, 린트, 타입, 단위 테스트 검사를 실행하여 모든 코드 변경 사항을 검증합니다. 백엔드(Python) 또는 프론트엔드(TypeScript) 작업 후에 사용하세요…
official
discovering-make-commands
streamlit
Streamlit 개발에 사용 가능한 make 명령어를 나열합니다. 빌드, 테스트, 린트 또는 포맷 작업에 사용하세요.
official
finalizing-pr
streamlit
병합을 위해 브랜치 변경 사항을 최종 확정하며, 코드 단순화, 검사 실행, 변경 사항 검토, 필요 시 PR 생성을 수행합니다. 변경 사항을 병합할 준비가 되었을 때 사용하세요.
official
fixing-flaky-e2e-tests
streamlit
불안정한 Playwright e2e 테스트를 진단하고 수정합니다. 테스트가 간헐적으로 실패하거나, 시간 초과 오류가 발생하거나, 스냅샷 불일치가 있거나, 브라우저별 특성을 보일 때 사용하세요.
official
generating-changelog
streamlit
두 개의 git 태그 사이에 있는 docs.streamlit.io용 정리된 웹사이트 릴리스 노트를 생성합니다. 새로운 Streamlit 릴리스를 준비하거나 변경 사항을 검토할 때 사용합니다.
official
improving-frontend-coverage
streamlit
프론트엔드 단위 테스트를 커버리지와 함께 실행하고, 커버리지 보고서를 분석하며, 커버리지를 약 0.2% 증가시키기 위해 의미 있는 테스트를 구현합니다. 다음 상황에서 사용하세요...
official