Skip to content

Instantly share code, notes, and snippets.

@sidpalas
Created July 22, 2025 01:43
Show Gist options
  • Save sidpalas/c61888240fd49ea61856b198541873c8 to your computer and use it in GitHub Desktop.
Save sidpalas/c61888240fd49ea61856b198541873c8 to your computer and use it in GitHub Desktop.
This uses the dorny/paths-filter action to determine which services in a monorepo have changed and then splits the output by language based on the directory structure
name: "Determine Services Changed"
description: "determine which services changed"
inputs:
github-token:
description: github token (passed to paths-filter action)
required: false
default: ""
outputs:
go_services:
description: "JSON array of changed Go services"
value: ${{ steps.matrices.outputs.go_services }}
node_services:
description: "JSON array of changed Node/React services"
value: ${{ steps.matrices.outputs.node_services }}
python_services:
description: "JSON array of changed Python services"
value: ${{ steps.matrices.outputs.python_services }}
runs:
using: "composite"
steps:
# Because this is a mono-repo, we must determine which applications have changed
- name: Paths Changes Filter
id: filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
token: ${{ inputs.github-token }}
filters: .github/utils/file-filters.yaml
- name: Generate matrices
id: matrices
shell: bash
run: |
# TODO: move this logic out of inline script
set -euo pipefail
# `changes` is a JSON array of filter names that matched any file
filters='${{ steps.filter.outputs.changes }}'
# for testing
go_json=$(jq -c '[ .[] | select(startswith("go/")) ]' <<<"$filters")
node_json=$(jq -c '[ .[] | select(startswith("node/") or startswith("react/")) ]'<<<"$filters")
python_json=$(jq -c '[ .[] | select(startswith("python/")) ]'<<<"$filters")
echo "go_services=$go_json" >>"$GITHUB_OUTPUT"
echo "node_services=$node_json" >>"$GITHUB_OUTPUT"
echo "python_services=$python_json" >>"$GITHUB_OUTPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment