$npx -y skills add opendatahub-io/ai-helpers --skill github-actions-debuggerDebug and monitor GitHub Actions workflow runs. Check run status, view failed job logs, and troubleshoot CI failures. Use this when the user needs to investigate GitHub Actions failures, inspect job output, or identify the root cause of a broken workflow run.
| 1 | # GitHub Actions Debugger |
| 2 | |
| 3 | This skill enables Claude to investigate GitHub Actions failures by: |
| 4 | |
| 5 | 1. Listing recent workflow runs and their status |
| 6 | 2. Identifying failed jobs within a run |
| 7 | 3. Retrieving failed job logs |
| 8 | 4. Analyzing error messages and suggesting next debugging steps |
| 9 | |
| 10 | ## Prerequisites |
| 11 | |
| 12 | - `gh` CLI installed and authenticated (`gh auth status` to verify) |
| 13 | - Git repository with a GitHub remote configured (for automatic repo detection) |
| 14 | |
| 15 | If `gh` is not installed, ask the user to follow installation instructions at https://cli.github.com/ |
| 16 | |
| 17 | If `gh` is not authenticated, ask the user to run `gh auth login`. |
| 18 | |
| 19 | ## Instructions |
| 20 | |
| 21 | When the user asks to check CI status, debug workflow failures, or view job logs, use the `gh` CLI commands below. |
| 22 | All commands auto-detect the GitHub repository from the git remote in the current working directory. |
| 23 | To target a different repository, add `-R <owner>/<repo>` to any command. |
| 24 | |
| 25 | ### Handling GitHub Actions URLs |
| 26 | |
| 27 | When the user provides a full GitHub Actions URL, parse it to extract the repository and run or job ID, |
| 28 | then use `-R` to target that repository. **Always use the repository from the URL, ignoring the local git remote.** |
| 29 | |
| 30 | Before constructing any command from a URL, validate the extracted values: |
| 31 | - Owner names must only contain letters, digits, and hyphens. |
| 32 | - Repository names must only contain letters, digits, hyphens, underscores, and dots. |
| 33 | - Run IDs and job IDs must be purely numeric. |
| 34 | - Workflow file names must only contain letters, digits, hyphens, underscores, and dots. |
| 35 | If any extracted value fails its rule, reject it and ask the user to provide a corrected URL or ID. |
| 36 | |
| 37 | - **Run URL** format: `https://github.com/<owner>/<repo>/actions/runs/<run-id>` |
| 38 | - Extract: `-R <owner>/<repo>` and `<run-id>` |
| 39 | - Example: `https://github.com/my-org/my-project/actions/runs/123456789` |
| 40 | becomes `gh run view 123456789 -R my-org/my-project` |
| 41 | |
| 42 | - **Workflow URL** format: `https://github.com/<owner>/<repo>/actions/workflows/<workflow-file>` |
| 43 | - Extract: `-R <owner>/<repo>` and `--workflow <workflow-file>` |
| 44 | - Example: `https://github.com/my-org/my-project/actions/workflows/ci.yaml` |
| 45 | becomes `gh run list --workflow ci.yaml -R my-org/my-project` |
| 46 | |
| 47 | ### Commands |
| 48 | |
| 49 | 1. **List Recent Workflow Runs** |
| 50 | - Run `gh run list --limit 10` to show the latest runs with their status, workflow name, and run ID |
| 51 | - Add `--status failure` to filter for only failed runs: |
| 52 | `gh run list --status failure --limit 10` |
| 53 | |
| 54 | 2. **Filter by Workflow File** |
| 55 | - Use `--workflow` to scope results to a specific workflow: |
| 56 | `gh run list --workflow ci.yaml --limit 10` |
| 57 | |
| 58 | 3. **View a Specific Run** |
| 59 | - Use `gh run view <run-id>` to see the run summary including all jobs and their status: |
| 60 | `gh run view <run-id>` |
| 61 | - Add `--log-failed` to immediately stream the logs of all failed jobs: |
| 62 | `gh run view <run-id> --log-failed` |
| 63 | |
| 64 | 4. **View Full Logs for a Run** |
| 65 | - To retrieve complete logs for every job in a run: |
| 66 | `gh run view <run-id> --log` |
| 67 | - Pipe through `grep` to isolate errors: |
| 68 | `gh run view <run-id> --log-failed 2>&1 | grep -i "error\|fail\|fatal" | head -50` |
| 69 | |
| 70 | 5. **Watch a Running Workflow** |
| 71 | - To follow a currently active run in real time: |
| 72 | `gh run watch <run-id>` |
| 73 | |
| 74 | 6. **Re-run Failed Jobs** |
| 75 | - If the user wants to retry only the failed jobs without re-running passing ones: |
| 76 | `gh run rerun <run-id> --failed` |
| 77 | |
| 78 | 7. **Troubleshoot CI Failures** |
| 79 | - First, list recent failed runs to identify the run ID (step 1) |
| 80 | - Then, view the run to see which jobs failed (step 3) |
| 81 | - Then, retrieve the failed job logs (step 3 with `--log-failed`) |
| 82 | - Analyze the log output to identify the root cause and suggest fixes |
| 83 | |
| 84 | ## Examples |
| 85 | |
| 86 | ```bash |
| 87 | # List the 10 most recent runs across all workflows |
| 88 | gh run list --limit 10 |
| 89 | ``` |
| 90 | |
| 91 | ```bash |
| 92 | # Show only failed runs for a specific workflow |
| 93 | gh run list --workflow ci.yaml --status failure --limit 10 |
| 94 | ``` |
| 95 | |
| 96 | ```bash |
| 97 | # View run summary and failed job logs for run ID 123456789 |
| 98 | gh run view 123456789 --log-failed |
| 99 | ``` |
| 100 | |
| 101 | ```bash |
| 102 | # Grep failed logs for actionable errors |
| 103 | gh run view 123456789 --log-failed 2>&1 | grep -i "error\|fail\|fatal" | head -50 |
| 104 | ``` |
| 105 | |
| 106 | ```bash |
| 107 | # Re-run only the failed jobs |
| 108 | gh run rerun 123456789 --failed |
| 109 | ``` |
| 110 | |
| 111 | ## Error Handling |
| 112 | |
| 113 | - If a run ID is not found, show the error and suggest running `gh run list` to find the correct ID |
| 114 | - If the repository cannot be detected, suggest using `-R <owner>/<repo>` or running from within the correct git repository |
| 115 | - If logs are unavailable (e.g., run too old or log retention expired), inform the user and suggest checking the GitHub Actions UI directly |