# How to Integrate no-mistakes with CI/CD Pipelines: Complete Setup Guide

> Seamlessly integrate no-mistakes with your CI/CD pipelines. This guide shows you how to leverage no-mistakes' built-in CI monitoring for automated fixes and improved workflow.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-06-28

---

**Yes, no-mistakes ships with a built-in CI-monitoring step that watches, reports, and auto-fixes CI failures by polling provider APIs directly, requiring no external orchestration.**

The `kunchenguid/no-mistakes` repository provides native support for CI/CD integration through its architecture designed to monitor pull request status. Whether you need to integrate no-mistakes with CI/CD pipelines as a standalone monitoring tool or embed it within existing GitHub Actions, GitLab CI, or Bitbucket Pipelines workflows, the implementation in [`internal/pipeline/steps/ci.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/ci.go) supports both approaches without complex infrastructure.

## Understanding the CI-Monitoring Architecture

The core CI integration centers around the `CIStep` type defined in [`internal/pipeline/steps/ci.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/ci.go). When you execute `no-mistakes run`, the pipeline instantiates this step to manage the entire lifecycle of CI monitoring for a pull request.

### Provider Detection and API Integration

The step begins by detecting your source-control provider using `scm.DetectProvider` based on the repository URL. It then instantiates provider-specific host objects—located in `internal/scm/github`, `internal/scm/gitlab`, and corresponding directories for other platforms—that handle API communication. These clients query PR state, mergeability, and CI check results directly from the provider's API, eliminating the need for webhook configuration or external CI orchestration.

### Polling Logic and Timeout Handling

Once initialized, the `CIStep` enters a polling loop that checks the PR at configurable intervals. The implementation re-arms an idle timeout whenever the upstream default branch advances, using the `defaultBaseBranchTipResolveWindow` parameter to determine when the base branch has moved. The step interprets CI status using canonical message constants defined in [`cimonitor/monitor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cimonitor/monitor.go): `ciChecksPassedMsg`, `ciNoChecksPassedMsg`, and `ciChecksRunningMsg`. Monitoring terminates when the PR merges, closes, or when the `ci_timeout` threshold expires.

## Configuring CI Integration via .no-mistakes.yaml

You control CI behavior through the repository-wide configuration file [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml), parsed by [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go). The configuration exposes specific knobs for timeout and auto-fix behavior:

- **`ci_timeout`**: Controls idle timeout duration. Set to `0` for the default 7-day limit, `"unlimited"` or a negative value for indefinite monitoring, or specify durations like `"2h"` or `"30m"`.
- **`auto_fix.ci`**: Sets the maximum number of automatic fix attempts for CI failures. Set to `0` to disable auto-fix entirely.
- **`checks_grace_period`**: Defines the minimum wait before treating an empty CI result as "no checks" (internal implementation detail).

## Running no-mistakes in CI/CD Environments

### Standalone Monitoring

To monitor a PR without external CI orchestration, run the tool directly in a repository with an open pull request:

```bash
no-mistakes run

```

The command automatically creates a `CIStep` that watches the PR's CI status, reports progress in the terminal UI, and applies auto-fixes if configured.

### Configuration File Example

Customize timeout and auto-fix behavior by creating [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) in your repository root:

```yaml
ci_timeout: "2h"
auto_fix:
  ci: 2

```

This configuration sets a 2-hour idle timeout and permits up to two automatic fix attempts before pausing for manual intervention.

### Integration with GitHub Actions

Invoke no-mistakes from an existing CI system to enforce safety gates. The following workflow runs no-mistakes as a pre-merge verification step:

```yaml

# .github/workflows/ci.yml

name: Verify PR with no‑mistakes
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  no-mistakes:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install no‑mistakes
        run: go install ./cmd/no-mistakes
      - name: Run CI monitor
        env:
          NM_HOME: ${{ runner.temp }}/nm-home
        run: no-mistakes run --ci-timeout=30m

```

In this pattern, the GitHub Actions job itself runs `no-mistakes`, which monitors the same PR's CI checks and can abort the workflow if the idle timeout expires or unrecoverable failures remain.

## Summary

- **Native CI step**: The `CIStep` implementation in [`internal/pipeline/steps/ci.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/ci.go) provides built-in monitoring for GitHub Actions, GitLab CI, Bitbucket Pipelines, and other SCM providers.
- **Direct API integration**: Provider-specific clients in `internal/scm/github` and related packages poll CI status directly without requiring external orchestration.
- **Flexible configuration**: Control timeouts via `ci_timeout` and auto-fix limits via `auto_fix.ci` in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml), parsed by [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go).
- **Dual execution modes**: Run standalone with `no-mistakes run` or invoke from existing CI systems to enforce safety gates before merge.

## Frequently Asked Questions

### Can no-mistakes integrate with GitHub Actions?

Yes, you can invoke `no-mistakes run` directly from GitHub Actions workflows. The tool detects the GitHub provider via `scm.DetectProvider` and uses the API client in `internal/scm/github` to poll PR status, making it fully compatible with GitHub Actions runners without additional plugins.

### What happens when CI checks fail?

According to the logic in [`internal/pipeline/steps/ci.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/steps/ci.go), when checks fail, the `CIStep` either pauses for human intervention or attempts automatic fixes based on the `auto_fix.ci` limit set in your configuration. The step reports status using canonical messages defined in [`cimonitor/monitor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cimonitor/monitor.go) to keep the UI and monitoring agents synchronized.

### How long does no-mistakes wait for CI to complete?

The polling loop respects the `ci_timeout` configuration value. By default, this is set to 7 days, but you can configure `"unlimited"` or negative values for indefinite monitoring, or specify specific durations like `"30m"` or `"2h"`. The step terminates when the PR merges, closes, or the timeout expires.

### Does no-mistakes require a specific CI provider?

No, the architecture supports any major source-control provider that exposes CI status via APIs. The `CIStep` uses generic interfaces implemented in provider-specific packages like `internal/scm/github` and `internal/scm/gitlab`, allowing the same monitoring logic to work across GitHub Actions, GitLab CI, Bitbucket Pipelines, and other platforms.