Automating DevOps with GitHub Actions

By KobiljonMarch 22, 20257 min read
GitHub Actions Automation

If you've ever deployed code on a Friday afternoon, only to realize you forgot to run tests — you know the pain. I used to manually run linting, tests, and builds before every deploy. It was tedious, error-prone, and wasted hours every week.


Then I discovered GitHub Actions, and it changed everything.


The Manual DevOps Nightmare

Before automation, my workflow looked like this:


  • • Run npm run lint manually
  • • Run npm test and pray everything passes
  • • Build the project with npm run build
  • • SSH into the server and deploy manually
  • • Hope I didn't miss a step

This worked fine for small projects. But as my team grew and we shipped features faster, the cracks started to show. Someone would forget to run tests. Another would push broken code to production. We needed automation.

"We spent more time fixing deployment issues than building features."

Enter GitHub Actions

GitHub Actions is a CI/CD platform built directly into GitHub. You define workflows using YAML files, and GitHub runs them automatically on events like push, pull request, or merge.


Here's a simple workflow that runs tests on every push:


name: CI Pipeline

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

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'

      - name: Install dependencies
        run: npm ci

      - name: Run linter
        run: npm run lint

      - name: Run tests
        run: npm test

With this single file, GitHub now runs linting and tests automatically on every push or pull request. No manual intervention required.


My Complete Automation Stack

Over time, I built a comprehensive workflow that handles everything from code quality to deployment. Here's what I automated:


1. Code Quality Checks

- name: Run ESLint
  run: npm run lint

- name: Run Prettier
  run: npm run format:check

- name: Type check
  run: npm run type-check

2. Automated Testing

- name: Run unit tests
  run: npm test

- name: Run integration tests
  run: npm run test:integration

- name: Generate coverage report
  run: npm run test:coverage

3. Build and Deploy

- name: Build application
  run: npm run build

- name: Deploy to Vercel
  uses: amondnet/vercel-action@v20
  with:
    vercel-token: ${{ secrets.VERCEL_TOKEN }}
    vercel-org-id: ${{ secrets.ORG_ID }}
    vercel-project-id: ${{ secrets.PROJECT_ID }}

Advanced Workflows I Use Daily

Automatic Dependency Updates

I use Dependabot (built into GitHub) to automatically create PRs when dependencies have security updates or new versions.


Branch Protection with Required Checks

I configured GitHub to block merges unless all checks pass. No more broken code in production.


Scheduled Jobs for Maintenance

on:
  schedule:
    - cron: '0 0 * * 0'  # Every Sunday at midnight

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
      - name: Clean old artifacts
        run: npm run cleanup

Time Savings & Impact

After implementing GitHub Actions across my projects:

  • • Saved 5+ hours per week on manual testing and deployment
  • • Reduced production bugs by 80%
  • • Deployment time dropped from 30 minutes to 3 minutes
  • • Caught breaking changes before they reached production

Common Pitfalls to Avoid

  • Don't hardcode secrets — use GitHub Secrets for API keys and tokens
  • Watch your build minutes — GitHub gives free minutes, but they run out quickly on large projects
  • Cache dependencies — use caching to speed up workflows significantly
  • Start simple — don't try to automate everything at once. Start with tests, then add more gradually

Best Practices I Follow

  • • Keep workflows modular — break complex pipelines into reusable actions
  • • Use matrix builds to test across multiple Node versions
  • • Set up notifications for failed workflows (Slack, Discord, email)
  • • Version control your workflows just like your code

When NOT to Use GitHub Actions

GitHub Actions is powerful, but it's not always the right fit. If you need heavy compute resources, complex orchestration, or multi-cloud deployments, consider tools like Jenkins, GitLab CI, or CircleCI.


Conclusion

Automation isn't about being lazy — it's about working smarter. GitHub Actions eliminated repetitive tasks, reduced human error, and freed up time to focus on building features instead of babysitting deployments.


If you're still manually running tests and deployments, you're wasting time. Start small, automate one workflow at a time, and watch your productivity soar.

Did you like this post?

Help others find it by sharing it on social media or with your team.

You Might Also Like