Github fix failed workflow
Diagnose and fix failed GitHub Actions workflow runs, and write or edit workflow files following clear, minimal conventions. Use when workflows fail, CI/CD issues occur, debugging GitHub Actions runs, or when creating or editing .github/workflows/*.yml files. Triggers on "fix workflow", "why did the build fail", "check CI status", "workflow failed", "create a workflow", "add GitHub Actions", or "set up CI".From its SKILL.md
npx -y skills add yaakaito/env --skill github-fix-failed-workflowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.3 KB, as published. Nobody here has run it
Fix Failed GitHub Workflow
Diagnose GitHub Actions workflow failures, apply fixes, and verify them. When a fix involves creating or editing workflow files, follow the Workflow File Guidelines below.
Fix Workflow
- Identify failed runs: Use
gh run listwith--branchor--workflowflag - Analyze logs: Use
gh run view <run_id> --log-failedto view error details - Diagnose issues: Identify root cause from log output
- Fix issues: Apply necessary fixes to workflow files or source code
- Verify: Confirm the fix with a new run (see Verify the Fix)
By Branch (Current Branch)
Find and fix failed workflows on the current branch:
# Get current branch
BRANCH=$(git branch --show-current)
# List runs on this branch
gh run list --branch "$BRANCH"
# View failed run logs
gh run view <run_id> --log-failed
By Workflow File
Find and fix failed workflows for a specific workflow file:
# List runs for a workflow file
gh run list --workflow=<workflow_file>
# View failed run logs
gh run view <run_id> --log-failed
Verify the Fix
- If the failure looks transient (network flake, runner outage), re-run without changes:
gh run rerun <run_id> --failed - If the fix changed files, a new run starts after the changes are pushed; watch it with
gh run watch <run_id>or checkgh run list --branch "$BRANCH" - If the run fails again, return to log analysis instead of retrying blindly
Common Issues
- Dependency failures: Check package versions and lock files
- Test failures: Review test output and fix failing tests
- Build errors: Check syntax errors and type issues
- Permission errors: Verify workflow permissions and secrets
- Timeout issues: Optimize long-running steps or increase timeout
Workflow File Guidelines
Write clear, minimal GitHub Actions workflow files.
Naming Guidelines
Do NOT name
runsteps that are self-explanatory from the command itselfusessteps for common, obvious actions like:actions/checkoutactions/setup-nodeoven-sh/setup-bunpnpm/action-setupactions/cache
DO name
usessteps withactions/github-script(explain what the script does)- Complex multi-line shell scripts (summarize the purpose)
- Steps where the intent is not obvious from the code
Examples
Good
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
- run: bun test
- name: Post build status to Slack
uses: actions/github-script@v7
with:
script: |
const webhook = process.env.SLACK_WEBHOOK;
// ... complex logic
Bad
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Build project
run: bun run build
- name: Run tests
run: bun test
Best Practices
- Pin action versions with full SHA or major version tag (
@v4, not@main) - Use
workflow_dispatchfor manual triggers when useful - Set appropriate
permissionsto follow least privilege - Use
concurrencyto cancel redundant runs - Prefer
${{ github.token }}over PAT when possible - Avoid emoji in workflow names and step names
- Use
$GITHUB_STEP_SUMMARYto output execution results in Markdown format - Avoid obvious comments; only add comments to explain complex logic
Step Summary Example
- name: Report test results
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "| Suite | Passed | Failed |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Unit | 42 | 0 |" >> $GITHUB_STEP_SUMMARY