Home › IT ops & DevOps › CI pipeline setup: how to do it with AI
CI pipeline setup: how to do it with AI
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.
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
- Say which CI system, language, test command and deploy target you use.
- Ask for a workflow that only builds and tests first, no deploy.
- Run it on a branch and read the log.
- Add deploy steps later with environment protection and manual approval.
- Check that secrets come from the CI secret store and are never written in the file.
- 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
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.
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]
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 testIllustrative example written for this guide, not output captured from a specific tool.
Safe practice
- Run anything that changes systems in a test VM or lab tenant first, never straight on production.
- Use a least-privilege account: only the rights the task needs, not Domain Admin or Global Administrator.
- Never paste passwords, API keys, connection strings, tenant IDs with secrets, or client secrets into a chat. Use placeholders like <SECRET>.
- Read every command that modifies or deletes before you run it, and ask the AI to list those lines separately.
Which tool to pick, and why
- GitHub Copilot: Lives in GitHub: the cloud agent works in GitHub Actions on issues and pull requests. Free plan includes agent mode in your editor. Visit official website ↗
- Claude (incl. Claude Code): Claude Code integrates with GitHub Actions and GitLab CI. Free plan can do this Visit official website ↗
- Cursor: Its agent can run your test command locally before you push. Visit official website ↗
- ChatGPT (incl. Work & Codex): Codex supports cloud coding tasks and PR review. Free plan can do this Visit official website ↗
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
- Writing a secret value directly in the workflow file.
- Giving the workflow write-all permissions.
- Letting the agent "fix" a failure by skipping tests.
- Adding deploy steps before build and test are stable.
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