CIprompt onlyIntermediate

Broken Workflow Repair

Automates the detection and resolution of failing CI/CD workflows by iteratively inspecting the latest GitHub Actions run, analyzing failures, and applying code fixes until the workflow passes successfully.

← all loops
CI/CDGitHub ActionsAutomationDebuggingWorkflow Repair

Goal

Fix failing workflows

How to Run

Run this loop in your preferred agent environment to automatically detect, diagnose, and repair failing GitHub Actions workflows.

  1. 01

    Setup Environment

    Ensure you're in a GitHub repository with active workflows and have the GitHub CLI (gh) installed and authenticated.

  2. 02

    Execute Kickoff Prompt

    Paste the kickoff prompt into the agent interface to initiate the workflow repair process.

  3. 03

    Monitor Progress

    Observe the agent's actions as it inspects failures, makes fixes, and checks for success. Intervene if needed based on guardrail constraints.

  4. 04

    Verify Fix

    Once the agent exits, manually verify that the workflow now passes and that changes made are acceptable.

Workflow Steps

  1. 01

    Check Latest Workflow Status

    Run 'gh run list' to identify the most recent workflow run and determine if it failed.

  2. 02

    Inspect Workflow Logs

    If failed, retrieve logs using 'gh run view <run-id> --log' to understand the root cause of failure.

  3. 03

    Analyze Codebase

    Examine relevant source files and workflow YAML to identify misconfigurations, missing dependencies, or incompatible code.

  4. 04

    Apply Targeted Fixes

    Modify workflow triggers, environment variables, or build scripts to address identified issues.

  5. 05

    Commit and Push Changes

    Stage changes with git, create a descriptive commit, and push to trigger a new workflow run.

  6. 06

    Validate Success

    Re-run the check command to confirm the latest workflow now passes.

Kickoff Prompt

Start the "Broken Workflow Repair" loop.

Goal: Fix failing workflows
Max iterations: 10
Between iterations run: gh run list
Exit when: Latest workflow successful


Analyze the latest GitHub Actions workflow run. If it failed, inspect the logs to identify the cause of failure, then modify the appropriate source or configuration files to fix the issue. Commit and push your changes, then re-check the workflow status. Repeat this process until the latest workflow run succeeds or you've reached 10 iterations.

Self-pace this loop. After each iteration, run `gh run list` and evaluate the output, and only continue if the exit condition is not met (Latest workflow successful). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.

Guardrails

hardcoded
  • ·Never modify more than 3 files per iteration to prevent cascading failures
  • ·Do not execute arbitrary shell commands without clear purpose
  • ·Stop immediately if any step takes longer than 10 minutes
  • ·Preserve existing code comments and structure unless directly related to failure
  • ·Only modify files within the .github/workflows directory unless build configuration is necessary

Flow Diagram

rendering…

Related loops — CI