Skip to content

PR Checks Fix

Analyze failed PR checks and optionally push fixes.

How it works

Triggered automatically when a CI workflow fails on a PR. Reads the failed job logs, identifies the root cause, and pushes a targeted fix to the PR branch. Posts a comment explaining the failure whether or not a fix was applied.

Quick Install

mkdir -p .github/workflows && curl -sL \
  https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/pr-checks-fix/example.yml \
  -o .github/workflows/pr-checks-fix.yml

Trigger

Event Types Condition
workflow_run completed CI workflow failed and the run is associated with a PR

Inputs

Input Description Required Default
additional-instructions Repo-specific instructions appended to the agent prompt No ""
setup-commands Shell commands run before the agent starts No ""
allowed-bot-users Allowlisted bot actor usernames (comma-separated) No github-actions[bot]

Safe Outputs

  • add-comment — post a comment explaining the failure (max 3)
  • push-to-pull-request-branch — push a fix to the PR branch

Example Workflow

name: PR Checks Fix
on:
  workflow_run:
    workflows: ["CI", "Build", "Test"]
    types: [completed]

permissions:
  actions: read
  contents: write
  discussions: write
  issues: write
  pull-requests: write

jobs:
  run:
    if: >-
      github.event.workflow_run.conclusion == 'failure' &&
      toJSON(github.event.workflow_run.pull_requests) != '[]'
    uses: elastic/ai-github-actions/.github/workflows/gh-aw-pr-checks-fix.lock.yml@v0
    secrets:
      COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}