BLOG DETAILS
GitHub Actions: Reusable Workflows and Matrix Builds
GitHub Actions is great until you copy-paste the same YAML into ten repos. Reusable workflows and matrix builds keep CI DRY and fast.
Matrix builds
Test across versions and operating systems in parallel from one job definition, catching compatibility issues early.
A matrix example
One block fans out into many parallel jobs.
strategy:
matrix:
node: [18, 20, 22]
steps:
- uses: actions/setup-node@v4
with: { node-version: ${{ matrix.node }} }
- run: npm test
Reusable workflows
Define a workflow once and call it from many repos with workflow_call, so improvements and fixes propagate everywhere automatically.
Key Takeaways
- Workflows live as YAML in your repo — versioned and reviewed just like code.
- Reusable workflows and composite actions cut copy-paste across repositories.
- Matrix builds test many language versions and operating systems in parallel.
- Cache dependencies and use OIDC for keyless, short-lived cloud authentication.
- Pin actions to a commit SHA to protect against supply-chain tampering.
Wrapping Up
Matrix plus reusable workflows turn GitHub Actions from copy-paste YAML into a maintainable CI platform.


3 Comments +10
Rahul Sharma
08 May 2026OIDC keyless auth was a game changer for us — no more long-lived cloud keys in secrets.
Diksha Singh
09 May 2026Reusable workflows cleaned up so much copy-paste across our repos.
Aman Tripathi
11 May 2026Pinning actions to a SHA after that supply-chain scare last year. Good call-out.