Home › IT ops & DevOps › CI pipeline setup: how to do it with AI

CI pipeline setup: how to do it with AI

Last checked

From official vendor pages; selected tasks also include dated logged-out free-plan trials. Report an error.

Intermediate Risk: Medium 🛠️ IT ops & DevOps

An agent can write a new GitHub Actions or GitLab CI workflow for your project, or read a failing pipeline and suggest a fix. It saves hours of trial and error with YAML syntax.

Who it’s for: Developers and DevOps engineers setting up or fixing build and test pipelines.

Why medium risk: Pipelines often hold deploy rights and secrets; a careless change can leak a secret or deploy untested code.

Best pick

ChatGPT has the highest score on our published rubric (94/100) of the 4 tools listed for this task. Codex supports cloud coding tasks and PR review.

Step by step

  1. Say which CI system, language, test command and deploy target you use.
  2. Ask for a workflow that only builds and tests first, no deploy.
  3. Run it on a branch and read the log.
  4. Add deploy steps later with environment protection and manual approval.
  5. Check that secrets come from the CI secret store and are never written in the file.
  6. Pin action versions and set minimal token permissions.

AI prompts to set up a CI pipeline

Replace the [brackets] with your details. See all prompt examples

Build and test
Write a GitHub Actions workflow for a [language] project that installs dependencies, runs [test command] on every pull request, and caches dependencies. Use minimal permissions (contents: read). No deploy steps.
Fix a failing run
This CI run fails. Explain the cause from the log, then propose the smallest change to the workflow file. Don't disable or skip tests.

[paste log + workflow]
Harden it
Review this workflow for security: overly broad permissions, unpinned actions, secrets printed to logs, and steps that run on untrusted pull requests.

[paste]

Illustrative example

You paste

Node.js project, tests run with npm test, GitHub Actions, run on pull requests.

A good answer looks like

name: test
on: [pull_request]
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npm test

Illustrative example written for this guide, not output captured from a specific tool.

Safe practice

Which tool to pick, and why

Reasons come from the capabilities, free-plan details and prices we've checked on official pages (separate from any dated trial above). Sources: github.com/features/copilot/plans · claude.com/pricing · cursor.com/pricing · chatgpt.com/pricing

Common mistakes

Privacy tip

Never paste secrets or CI tokens into a chat; refer to them by name (secrets.DEPLOY_TOKEN). If one ends up in a log or chat, rotate it.

GitHub Copilot setting · Claude (incl. Claude Code) setting · Cursor setting · Sources: github.com/features/copilot/plans · privacy.claude.com/en/articles/12109829-how-do-i-change-my-model-improvement-privacy-settings · cursor.com/help/security-and-privacy/privacy

Related tasks

Report an error on this page