Skip to content

GitHub Actions Workflows

This documentation provides a comprehensive overview of all workflows and custom actions in the Hatchgrid monorepo.



File: .github/workflows/monorepo-ci.yml

Main workflow that orchestrates the entire CI/CD process, including security analysis, linting, testing, and integration.

on:
push:
branches: [ main ]
paths-ignore: [ '**.md', '.github/workflows/backend-ci.yml', ... ]
pull_request:
paths-ignore: [ '**.md', '.github/workflows/backend-ci.yml', ... ]
workflow_dispatch:
inputs:
environment: [ development, staging ]
  1. labeler - Automatic PR labeling
  2. codeql-analysis - Security analysis (JavaScript, Kotlin)
  3. super-linter - Code validation with multiple linters
  4. dependency-review - Dependency review in PRs
  5. owasp-dependency-check - OWASP vulnerability analysis
  6. backend - Delegation to backend workflow
  7. frontend - Delegation to frontend workflow
  8. integration - Post-build integration tests
  • Concurrency: Cancels previous runs on the same branch
  • Security: Multiple layers of security analysis
  • Artifacts: Generates integration and security reports

File: .github/workflows/backend-ci.yml

Specific CI for the backend developed in Kotlin/Java with Gradle.

paths:
- 'server/**'
- 'shared/**'
- 'build.gradle.kts'
- 'settings.gradle.kts'
- 'gradle/**'
  • Tool: Detekt for Kotlin static analysis
  • Integration: Reviewdog for automatic PR comments
  • Format: SARIF reports for GitHub Security
  • Build: ./gradlew build -x test
  • Testing: ./gradlew test
  • Coverage: Kover → Codecov
  • Artifacts: Compiled JARs and test reports
  • NVD_API_KEY: For dependency vulnerability analysis

File: .github/workflows/frontend-ci.yml

Specific CI for the frontend developed in Node.js/TypeScript.

paths:
- 'client/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
  • Tool: Biome for linting and formatting
  • Integration: Reviewdog for PR feedback
  • Configuration: Fails on errors, warnings as suggestions
  • Command: pnpm build
  • Artifacts: Compiled applications and landing page
  • Command: pnpm test
  • Coverage: LCOV → Codecov

File: .github/workflows/deploy.yml

Deployment pipeline with support for multiple environments and deployment strategies.

# Manual with environment selection
workflow_dispatch:
inputs:
environment:
type: choice
description: "Select the deployment environment"
options:
- development
- staging
- production
# Automatic based on branch/tag
push:
branches: [main] # → development
tags: ['v*'] # → production

Environment determination logic:

  • Manual: Uses user input
  • Tag v*: production
  • Push to main: development
  • Compilation with Gradle
  • Docker image build
  • Security scanning with Trivy
  • Push to GitHub Container Registry
  • Compilation with pnpm
  • Docker image build
  • Security scanning with Trivy
  • Push to GitHub Container Registry
  • kubectl configuration
  • K8s manifests update
  • Cluster deployment
  • Rollout verification
  • Image scanning with Trivy
  • SARIF results to GitHub Security
  • Manifests versioned by SHA

File: .github/workflows/cleanup-cache.yml

Automatic cache cleanup when a PR is closed to optimize storage usage.

on:
pull_request:
types: [closed]
jobs:
cleanup:
steps:
- run: gh extension install actions/gh-actions-cache
- run: gh actions-cache list -R $REPO -B $BRANCH
- run: gh actions-cache delete $cacheKey --confirm

File: .github/workflows/issue-labeler.yml

Automatic issue labeling based on content and patterns.

  • Config file: .github/issue-labeler-config.yml
  • Trigger: Issues opened/edited
  • Action: github/issue-labeler

File: .github/workflows/semantic-pull-request.yml

PR title validation according to Conventional Commits.

  • Validation: Conventional Commits spec
  • Feedback: Automatic PR comments
  • Auto-cleanup: Removes comments when fixed
feat: add user authentication
fix: resolve memory leak in cache
docs: update API documentation
chore: update dependencies

File: .github/workflows/test-pnpm.yml

Test workflow to verify pnpm configuration.

  • Manual execution only (workflow_dispatch)
  • Debugging configuration issues
  • Version and path verification

Location: .github/actions/setup/java/

- name: Setup Java
uses: ./.github/actions/setup/java

Features:

  • Java 21 (Eclipse Temurin)
  • Gradle wrapper
  • Automatic dependency caching

Location: .github/actions/setup/node/

- name: Setup Node.js and pnpm
uses: ./.github/actions/setup/node

Features:

  • Node.js 22
  • pnpm 10.13.1
  • Intelligent store caching
  • Installation with frozen-lockfile

Location: .github/actions/docker/

Note: Specialized Docker actions have replaced the previous generic Docker action. For more details, see the Docker actions documentation.

Backend Docker Action:

- name: Build and push backend Docker image
uses: ./.github/actions/docker/backend/action.yml
with:
image-name: backend
github-token: ${{ secrets.GITHUB_TOKEN }}
gradle-args: "-Pversion=latest -Penv=production"
module-path: server:thryve
deliver: 'true'

Frontend Web App Action:

- name: Build and push frontend web app Docker image
uses: ./.github/actions/docker/frontend-web/action.yml
with:
image-name: frontend-web
github-token: ${{ secrets.GITHUB_TOKEN }}
build-env: production
api-url: https://api.example.com
deliver: 'true'

Frontend Landing Page Action:

- name: Build and push frontend landing page Docker image
uses: ./.github/actions/docker/frontend-landing/action.yml
with:
image-name: frontend-landing
github-token: ${{ secrets.GITHUB_TOKEN }}
build-env: production
base-url: https://example.com
deliver: 'true'

Security Scanning Action:

- name: Scan Docker image for vulnerabilities
uses: ./.github/actions/docker/security-scan/action.yml
with:
image-ref: ghcr.io/myorg/myapp:latest
report-name: myapp-security-scan
category: backend-trivy

Features:

  • Specialized actions by application type
  • GitHub Container Registry and Docker Hub
  • GitHub Actions cache
  • Integrated Trivy security scanning
  • Automatic metadata
  • Multi-platform support

  • Backend CI: ~8-12 minutes
  • Frontend CI: ~5-8 minutes
  • Monorepo CI: ~15-20 minutes
  • Deploy: ~10-15 minutes
  • Gradle: ~85-90%
  • pnpm: ~90-95%
  • Docker: ~70-80%
  • Test reports (JUnit XML)
  • Coverage reports (Kover, LCOV)
  • Security reports (SARIF)
  • Docker images
  • Integration reports

  • CodeQL: Static code analysis
  • OWASP: Dependency vulnerabilities
  • Trivy: Docker image scanning
  • Dependency Review: New dependency review
CODECOV_TOKEN # Coverage upload
NVD_API_KEY # Vulnerability API
KUBECONFIG # Kubernetes configuration
GITHUB_TOKEN # Automatic, for registry

Each workflow has specific minimum permissions following the principle of least privilege.


  • Use specific versions with SHA hash
  • Regular updates with Dependabot
  • Test changes in development branches
  • Parallelization of independent jobs
  • Intelligent caching with specific keys
  • Concurrency to cancel obsolete runs
  • Updated documentation
  • Execution metrics monitoring
  • Regular configuration review

For detailed documentation of specific workflows, see: