15 Prompts for CI/CD: GitHub Actions, GitLab CI, and ArgoCD

15 Prompts for CI/CD: GitHub Actions, GitLab CI, and ArgoCD

Continuous Integration and Continuous Delivery (CI/CD) pipelines have become the backbone of modern software development. Whether you're using GitHub Actions, GitLab CI, or ArgoCD, crafting the right prompts for AI assistants can dramatically speed up your pipeline configuration, debugging, and optimization. This article provides 15 ready-to-use prompts, each with an explanation and a real-world example, designed to save you hours of trial and error.

Introduction

Setting up CI/CD pipelines often involves repetitive tasks: writing YAML configurations, debugging failed builds, or integrating with cloud services. By using targeted prompts, you can leverage AI to generate boilerplate code, suggest best practices, and even troubleshoot errors. According to the 2025 State of DevOps Report from Puppet, organizations that fully automate their CI/CD pipelines deploy 208 times more frequently than those with manual processes. This collection of prompts covers three major tools—GitHub Actions, GitLab CI, and ArgoCD—and addresses common scenarios like multi-stage builds, environment-specific deployments, and security scanning.

Prompts for GitHub Actions

1. Basic CI Pipeline for a Node.js Application

Task: Generate a GitHub Actions workflow that runs tests on every push to the main branch.

Prompt:

Create a GitHub Actions workflow for a Node.js application. It should trigger on push to main and on pull requests. Use Ubuntu runner, install dependencies with npm ci, run tests with npm test, and cache node_modules for faster builds.

Example:

name: Node.js CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20'
    - name: Cache node_modules
      uses: actions/cache@v3
      with:
        path: node_modules
        key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
    - run: npm ci
    - run: npm test

2. Multi-Environment Deployment with Environment Secrets

Task: Create a workflow that deploys to staging and production environments using GitHub Environments and secrets.

Prompt:

Write a GitHub Actions workflow for deploying a Docker container to staging (on push to develop) and production (on push to main). Use environment secrets for database URLs and API keys. Include a manual approval gate for production.

Example:

name: Deploy to Staging and Production

on:
  push:
    branches: [ develop, main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
    steps:
    - uses: actions/checkout@v4
    - name: Build Docker image
      run: docker build -t myapp:${{ github.sha }} .
    - name: Deploy
      run: |
        echo "Deploying to ${{ github.ref_name == 'main' && 'production' || 'staging' }}"
        # Use secrets: ${{ secrets.DATABASE_URL }}

3. Automated Dependency Updates with Dependabot

Task: Configure Dependabot to automatically create pull requests for outdated dependencies.

Prompt:

Generate a GitHub Actions workflow that uses Dependabot to check for npm and Docker dependency updates weekly. Include labels and assignees for the PRs.

Example:

version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "weekly"
    labels:
      - "dependencies"
    assignees:
      - "dev-team"
  - package-ecosystem: "docker"
    directory: "/"
    schedule:
      interval: "weekly"

4. Security Scanning with CodeQL

Task: Integrate CodeQL analysis into a GitHub Actions workflow for code security.

Prompt:

Create a GitHub Actions workflow that runs CodeQL analysis on every push to main and on pull requests. Initialize CodeQL, perform analysis, and upload results. Use JavaScript analysis.

Example:

name: CodeQL

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: github/codeql-action/init@v3
      with:
        languages: javascript
    - uses: github/codeql-action/analyze@v3

5. Custom Action for Slack Notifications

Task: Create a custom action that sends a Slack notification after a deployment.

Prompt:

Write a GitHub Actions composite action that sends a Slack message using a webhook URL. The action should accept a message parameter and the webhook URL as an input.

Example:

name: Slack Notification
inputs:
  webhook_url:
    required: true
  message:
    required: true
runs:
  using: composite
  steps:
  - run: |
      curl -X POST -H 'Content-type: application/json' \
        --data '{"text":"${{ inputs.message }}"}' \
        ${{ inputs.webhook_url }}
    shell: bash

Prompts for GitLab CI

6. Basic GitLab CI for a Python Application

Task: Set up a GitLab CI pipeline that runs tests for a Python app using pytest.

Prompt:

Create a .gitlab-ci.yml for a Python application. Use a Python 3.11 image, install dependencies from requirements.txt, run tests with pytest, and cache pip packages. Trigger on push to main.

Example:

image: python:3.11

stages:
  - test

cache:
  paths:
    - .pip-cache/

before_script:
  - pip install --cache-dir .pip-cache -r requirements.txt

test:
  stage: test
  script:
    - pytest
  only:
    - main

7. Multi-Stage Pipeline with Build, Test, and Deploy

Task: Build a pipeline with three stages: build, test, and deploy to staging.

Prompt:

Generate a GitLab CI pipeline with stages: build (compile code), test (run unit and integration tests), and deploy (deploy to staging using Docker). Use artifacts to pass built binaries between stages.

Example:

image: docker:latest

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script:
    - docker build -t myapp:$CI_COMMIT_SHA .
    - mkdir -p artifacts
    - echo $CI_COMMIT_SHA > artifacts/version.txt
  artifacts:
    paths:
      - artifacts/

test:
  stage: test
  script:
    - docker run myapp:$CI_COMMIT_SHA npm test

deploy_staging:
  stage: deploy
  script:
    - docker push myapp:$CI_COMMIT_SHA
    - echo "Deploying to staging"
  only:
    - develop

8. Parallel Jobs for Faster Feedback

Task: Run linting, unit tests, and integration tests in parallel.

Prompt:

Create a GitLab CI pipeline that runs lint, unit tests, and integration tests in parallel on every push. Use different Docker images for each job to optimize speed.

Example:

image: node:20

stages:
  - quality

lint:
  stage: quality
  script:
    - npm ci
    - npm run lint

unit_tests:
  stage: quality
  script:
    - npm ci
    - npm run test:unit

integration_tests:
  stage: quality
  script:
    - npm ci
    - npm run test:integration

9. Environment-Specific Variables with GitLab CI/CD Environment Scopes

Task: Use GitLab CI environment scopes to automatically inject variables for staging and production.

Prompt:

Write a GitLab CI job that deploys to staging or production based on the branch name. Use environment scopes to select appropriate variables (e.g., STAGING_URL vs PRODUCTION_URL). Include a manual trigger for production.

Example:

deploy:
  stage: deploy
  script:
    - echo "Deploying to $ENVIRONMENT"
  environment:
    name: $CI_ENVIRONMENT_NAME
  rules:
    - if: $CI_COMMIT_BRANCH == "main"
      when: manual
      variables:
        ENVIRONMENT: production
    - if: $CI_COMMIT_BRANCH == "develop"
      variables:
        ENVIRONMENT: staging

10. Integration with Kubernetes via GitLab CI

Task: Automate deployment to a Kubernetes cluster using kubectl in GitLab CI.

Prompt:

Generate a GitLab CI job that deploys a Docker image to a Kubernetes cluster. Use the kubectl image, set up kubeconfig from a CI variable, and apply a deployment.yaml file.

Example:

deploy_k8s:
  stage: deploy
  image: bitnami/kubectl:latest
  script:
    - kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_SHA
  only:
    - main

Prompts for ArgoCD

11. Basic Application Definition for ArgoCD

Task: Create an ArgoCD Application manifest that syncs a Git repo to a Kubernetes cluster.

Prompt:

Write an ArgoCD Application YAML that watches a GitHub repository for changes and syncs manifests to a namespace called 'production'. Use automatic sync with prune.

Example:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/myorg/myapp.git
    targetRevision: HEAD
    path: kubernetes
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

12. Sync Wave Order for Dependencies

Task: Configure sync waves in ArgoCD to deploy a database before an application.

Prompt:

Create two ArgoCD Application resources: one for PostgreSQL (sync wave 0) and one for the app (sync wave 1). The app should only sync after the database is healthy.

Example:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: postgres
  annotations:
    argocd.argoproj.io/sync-wave: "0"
spec:
  ...
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp
  annotations:
    argocd.argoproj.io/sync-wave: "1"
spec:
  ...

13. Blue-Green Deployment Strategy

Task: Implement a blue-green deployment using Argo Rollouts and ArgoCD.

Prompt:

Write an Argo Rollout resource that performs a blue-green update. It should have a preview service for the new version and switch traffic after successful health checks.

Example:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: myapp-rollout
spec:
  replicas: 5
  strategy:
    blueGreen:
      activeService: myapp-active
      previewService: myapp-preview
      autoPromotionEnabled: false
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: myapp:latest

14. Automated Sync with Webhook from GitHub

Task: Configure ArgoCD to automatically sync when changes are pushed to a GitHub repo.

Prompt:

Provide the ArgoCD settings and GitHub webhook configuration to enable automatic sync. Include the webhook secret and the necessary RBAC permissions.

Example:

# argocd-cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
data:
  repositories: |
    - url: https://github.com/myorg/myapp.git
      type: git
      passwordSecret:
        name: webhook-secret

15. Multi-Cluster Deployment with ArgoCD

Task: Deploy the same application to multiple Kubernetes clusters using ArgoCD.

Prompt:

Create two ArgoCD Application resources targeting different clusters (e.g., us-east and eu-west). Use the same source repo but different destination clusters.

Example:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp-us
spec:
  source:
    repoURL: https://github.com/myorg/myapp.git
    path: kubernetes
  destination:
    server: https://us-east-cluster.example.com
    namespace: production
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: myapp-eu
spec:
  source:
    repoURL: https://github.com/myorg/myapp.git
    path: kubernetes
  destination:
    server: https://eu-west-cluster.example.com
    namespace: production

Conclusion

These 15 prompts cover the most common CI/CD tasks across GitHub Actions, GitLab CI, and ArgoCD. By adapting them to your specific stack, you can reduce pipeline setup time significantly. Remember to always test prompts in a staging environment before applying to production. For deeper integration with external services, ASI Biont supports connecting to CI/CD tools via API — more details at asibiont.com/courses. Happy automating!

← All posts

Comments