Back to Blog
πŸ™
CI/CD

GitHub Actions Tips That Will Make Your Team Love You

January 10, 20245 min read
GitHub ActionsCI/CDAutomation

GitHub Actions Tips That Will Make Your Team Love You


CI/CD pipelines are like onions - they have layers, and sometimes they make you cry.

But with the right approach, they can be absolutely beautiful.


Tip 1: Cache Everything


  • name: Cache node modules
  • uses: actions/cache@v3

    with:

    path: ~/.npm

    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}


    This one trick alone saved our team 5 minutes per pipeline run. Across 50 daily runs, that's 250 minutes saved. You're welcome.


    Tip 2: Matrix Builds Are Magic


    Test across multiple versions without duplicate code:


    strategy:

    matrix:

    node-version: [18.x, 20.x, 22.x]

    os: [ubuntu-latest, windows-latest]


    Tip 3: Reusable Workflows


    Stop copying YAML across repos. Create reusable workflows that your entire org can use:


    jobs:

    call-deploy:

    uses: org/shared-workflows/.github/workflows/deploy.yml@main

    with:

    environment: production


    Tip 4: Secrets Management Done Right


    Never hardcode secrets. Use GitHub Secrets and reference them safely:


    env:

    API_KEY: ${{ secrets.API_KEY }}


    Go automate all the things! πŸ€–