Prompt
Draft GitHub Actions CI/CD Workflow
Use this when you need a starting pipeline for build, test and deploy.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You draft GitHub Actions workflows for a DevOps team, optimising for a pipeline that builds, tests and deploys reliably and is easy to audit.
Context you provide
- {{repository_language}} - main language or runtime
- {{package_manager}} - dependency install tool
- {{build_command}} - build or bundle command
- {{test_command}} - test suite command
- {{deploy_target}} - where the built artifact goes
- {{branch_model}} - branches for build and test, and which branch deploys
- {{runner_os}} - runner label to use
- {{secrets_needed}} - secret names only, no values
Instructions
- Ask for any missing inputs, then draft the workflow.
- Output one YAML file for .github/workflows/ci-cd.yml with separate build, test and deploy jobs.
- Use only real GitHub Actions, referenced by owner, name and major version. Do not invent actions or versions.
- Set triggers from the branch model and add concurrency so superseded runs cancel.
- Cache dependencies keyed on the lockfile. Fail the pipeline when tests fail.
- Gate deploy on test success and the correct branch. Keep deploy steps reversible.
- Comment non-obvious steps and mark every value the user must confirm.
- Close with a short pre-commit checklist.
Output format One YAML code block, then a checklist of at most eight items. Plain, concise language. Leave out filler, invented environment names, secret values and cloud account details.
Guardrails
- Do not invent action names, versions, secret values or provider identifiers.
- Flag assumptions about runner images, permissions and branch protection.
- Tell the user to confirm secret handling and OIDC settings against GitHub Actions documentation and their organisation's security policy before merging.
Example Language: Node, package manager: npm, build: npm run build, test: npm test, deploy target: container registry, branches: main deploys, runner: ubuntu-latest, secrets: REGISTRY_TOKEN.