Skip to main content

GitHub Actions CI/CD Pipeline from Scratch

Build a complete GitHub Actions CI/CD pipeline — linting, testing, building, security scanning, staging deploy, and production release.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt scaffolds a complete GitHub Actions CI/CD pipeline for a [project_type] project. It produces ten coordinated workflows: PR checks (lint with [linter], test with [test_command], type check, security scan), build-and-artifact on merge to [main_branch], staging deploy on [staging_branch], gated production deploy, a rollback workflow, a scheduled dependency audit ([audit_schedule]), semantic-versioned releases, a cache strategy for [cache_targets], matrix testing across [test_matrix], and Slack failure notifications, all using reusable workflows and composite actions.

The structure works because it wires the trust-building pieces in from the start: PR gates, security scanning, a real rollback path, and concurrency controls. A pipeline people don't trust gets bypassed, so the prompt deliberately includes notifications and concurrency so failures are visible and runs don't stomp on each other. The reusable-workflow and composite-action emphasis keeps the YAML from rotting into copy-pasted duplication as the project grows.

When to use it

  • Standing up CI/CD for a new repo before bad habits calcify.
  • Adding a real rollback and staging path to a pipeline that only does "deploy on merge."
  • Introducing security scanning and scheduled dependency audits to an existing project.
  • Setting up matrix testing across [test_matrix] to catch version-specific breakage.
  • Consolidating duplicated workflow YAML into reusable workflows and composite actions.
  • Wiring Slack notifications so a failing pipeline is impossible to ignore.

Example output

You get a set of YAML workflow files plus supporting config: a PR-check workflow running [linter] and [test_command], a build workflow, environment-gated deploy workflows for staging and production, a rollback workflow, a scheduled audit on [audit_schedule], a release workflow with changelog generation, cache configuration for [cache_targets], a test matrix block, reusable/composite action definitions, secrets setup notes, and concurrency controls. Expect to adapt secret names and deploy steps to your provider.

Pro tips

  • Set [test_command] to your exact command including coverage flags, so the generated job matches what runs locally.
  • Keep [cache_targets] tight; caching the wrong directories can cache stale builds or balloon storage.
  • Use real branch names for [main_branch] and [staging_branch]; mismatches silently skip workflow triggers.
  • Treat the generated secrets as placeholders and wire them through GitHub Environments for the production gate.
  • Validate the [test_matrix] against versions you actually support; testing dead versions wastes minutes.
  • Run the production deploy behind manual approval first, then automate once the rollback workflow is proven.

Frequently Asked Questions

Does this pipeline include a rollback path?
Yes. A dedicated rollback workflow is part of the ten generated workflows, alongside the gated production deploy. Having a tested rollback before you automate production is what lets the team trust the pipeline rather than deploying manually out of fear of getting stuck.
How do I set up the secrets it references?
The generated workflows reference secret names as placeholders; wire the actual values through GitHub repository or Environment secrets. Use Environments specifically for the production gate so the deploy requires approval and the secrets are scoped to that environment rather than exposed everywhere.
Can I use a test command other than the default?
Absolutely. Set `[test_command]` to your project's exact command, including coverage and reporter flags. Matching it precisely to what you run locally means the PR-check job reproduces local results and avoids the confusion of CI passing while local fails or vice versa.
Why does the prompt insist on reusable workflows and composite actions?
Because duplicated YAML rots. As the pipeline grows, copy-pasted steps drift out of sync and become hard to maintain. Reusable workflows and composite actions centralize shared logic so one change updates every place that uses it, keeping the pipeline maintainable long term.
Will the matrix testing slow down my pipeline?
It can, since each entry in `[test_matrix]` runs the suite. Keep the matrix limited to versions you actually support, drop end-of-life ones, and lean on caching `[cache_targets]` to keep jobs fast. The cross-version coverage is usually worth the extra minutes for libraries and shared tooling.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in DevOps & Cloud Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support