{"slug": "auto-pr-auto-deploy-workflow-using-ci-cd-pipline", "title": "Auto PR + Auto Deploy workflow using CI/CD Pipline", "summary": "This article describes a production-style automated workflow using GitHub Actions that creates a pull request automatically when a feature branch is pushed, runs continuous integration checks (tests and linting) before merging, and then automatically deploys the application to production (using Vercel for frontend and Render for backend) once the PR is merged to the main branch. The setup includes branch protection rules, required secrets for deployment tokens, and a final architecture that ensures only clean, tested code reaches production.", "body_md": "Here’s a real production-style Auto PR + Auto Deploy workflow using GitHub Actions. This is the kind of setup used in teams to keep main\nstable and deployments automatic.\nWe’ll build it in 3 parts:\n``` plaintext id=\"flow1\"\nfeature branch push\n↓\nAuto PR created (GitHub Action)\n↓\nCI runs (tests, lint)\n↓\nPR merged to main\n↓\nAuto deploy to production\n---\n# 🤖 1. Auto Create Pull Request Workflow\nThis automatically creates a PR when you push a feature branch.\n## 📁 `.github/workflows/auto-pr.yml`\n``` yaml id=\"pr1\"\nname: Auto Create Pull Request\non:\npush:\nbranches-ignore:\n- main\njobs:\ncreate-pr:\nruns-on: ubuntu-latest\nsteps:\n- name: Checkout\nuses: actions/checkout@v4\n- name: Create Pull Request\nuses: repo-sync/pull-request@v2\nwith:\ndestination_branch: main\ngithub_token: ${{ secrets.GITHUB_TOKEN }}\npr_title: \"Auto PR: ${{ github.ref_name }}\"\npr_body: |\n## 🤖 Auto-generated PR\nBranch: `${{ github.ref_name }}`\nPlease review changes before merging.\nfeature/login\nfeature/login → main\nThis ensures only clean code gets merged.\n.github/workflows/ci.yml\n``` yaml id=\"ci1\"\nname: CI Checks\non:\npull_request:\nbranches: [ main ]\njobs:\ntest:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v4\n- name: Setup Node\nuses: actions/setup-node@v4\nwith:\nnode-version: 20\n- name: Install dependencies\nrun: npm install\n- name: Run lint\nrun: npm run lint\n- name: Run tests\nrun: npm test\n---\n## 🧠 What this does:\nBefore merge:\n* Runs lint checks\n* Runs tests\n* Blocks bad code from merging\n---\n# 🚀 3. Auto Deploy on Merge to Main\nThis deploys your app when PR is merged.\n## 📁 `.github/workflows/deploy.yml`\n### Example: Deploy React + Node (Vercel + Render)\n``` yaml id=\"deploy1\"\nname: Auto Deploy\non:\npush:\nbranches: [ main ]\njobs:\ndeploy-frontend:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v4\n- name: Install frontend\nworking-directory: client\nrun: npm install\n- name: Build frontend\nworking-directory: client\nrun: npm run build\n- name: Deploy to Vercel\nrun: npx vercel --prod --token=${{ secrets.VERCEL_TOKEN }}\ndeploy-backend:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v4\n- name: Install backend\nworking-directory: server\nrun: npm install\n- name: Deploy backend (Render webhook)\nrun: curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }}\nGo to:\n👉 Repo → Settings → Secrets → Actions\nAdd:\n``` plaintext id=\"sec1\"\nVERCEL_TOKEN=your_vercel_token\nRENDER_DEPLOY_HOOK=https://api.render.com/deploy/xxx\n---\n# 🧭 5. Full Workflow in action\n## Developer flow:\n``` plaintext id=\"flow2\"\ngit checkout -b feature-login\ngit push origin feature-login\nIn GitHub:\nSettings → Branches → main\nEnable:\n``` yaml id=\"notif1\"\n``` bash id=\"tag1\"\ngit tag v1.0.0\ngit push origin v1.0.0\n---\n# ⚠️ Common mistakes\n### ❌ Auto-deploy without tests\n→ leads to broken production\n### ❌ No branch protection\n→ anyone can push to main\n### ❌ Missing secrets\n→ deployment fails silently\n---\n# 🧠 Final Architecture (Pro level)\n``` plaintext id=\"final1\"\nFeature Branch\n↓\nAuto PR Created\n↓\nCI (tests + lint)\n↓\nReview + Approval\n↓\nMerge to main\n↓\nCD Pipeline\n↓\nFrontend deploy (Vercel)\nBackend deploy (Render/AWS)\n↓\nSlack/Discord notification", "url": "https://wpnews.pro/news/auto-pr-auto-deploy-workflow-using-ci-cd-pipline", "canonical_source": "https://dev.to/kyl67899/auto-pr-auto-deploy-workflow-using-cicd-pipline-4eoh", "published_at": "2026-05-23 21:00:37+00:00", "updated_at": "2026-05-23 21:32:09.978071+00:00", "lang": "en", "topics": ["developer-tools", "cloud-computing", "open-source"], "entities": ["GitHub Actions", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/auto-pr-auto-deploy-workflow-using-ci-cd-pipline", "markdown": "https://wpnews.pro/news/auto-pr-auto-deploy-workflow-using-ci-cd-pipline.md", "text": "https://wpnews.pro/news/auto-pr-auto-deploy-workflow-using-ci-cd-pipline.txt", "jsonld": "https://wpnews.pro/news/auto-pr-auto-deploy-workflow-using-ci-cd-pipline.jsonld"}}